commit
						cc170e3d86
					
				
					 2 changed files with 19 additions and 17 deletions
				
			
		|  | @ -5,6 +5,7 @@ namespace Tests\Feature; | ||||||
| use App\Models\Account; | use App\Models\Account; | ||||||
| use App\Models\User; | use App\Models\User; | ||||||
| use Illuminate\Foundation\Testing\RefreshDatabase; | use Illuminate\Foundation\Testing\RefreshDatabase; | ||||||
|  | use Inertia\Testing\Assert; | ||||||
| use Tests\TestCase; | use Tests\TestCase; | ||||||
| 
 | 
 | ||||||
| class ContactsTest extends TestCase | class ContactsTest extends TestCase | ||||||
|  | @ -56,26 +57,26 @@ class ContactsTest extends TestCase | ||||||
|     { |     { | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/contacts') |             ->get('/contacts') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Contacts/Index') |                 ->component('Contacts/Index') | ||||||
|                 ->has('contacts.data', 2) |                 ->has('contacts.data', 2) | ||||||
|                 ->has('contacts.data.0', fn ($assert) => $assert |                 ->has('contacts.data.0', fn (Assert $assert) => $assert | ||||||
|                     ->where('id', 1) |                     ->where('id', 1) | ||||||
|                     ->where('name', 'Martin Abbott') |                     ->where('name', 'Martin Abbott') | ||||||
|                     ->where('phone', '555-111-2222') |                     ->where('phone', '555-111-2222') | ||||||
|                     ->where('city', 'Murphyland') |                     ->where('city', 'Murphyland') | ||||||
|                     ->where('deleted_at', null) |                     ->where('deleted_at', null) | ||||||
|                     ->has('organization', fn ($assert) => $assert |                     ->has('organization', fn (Assert $assert) => $assert | ||||||
|                         ->where('name', 'Example Organization Inc.') |                         ->where('name', 'Example Organization Inc.') | ||||||
|                     ) |                     ) | ||||||
|                 ) |                 ) | ||||||
|                 ->has('contacts.data.1', fn ($assert) => $assert |                 ->has('contacts.data.1', fn (Assert $assert) => $assert | ||||||
|                     ->where('id', 2) |                     ->where('id', 2) | ||||||
|                     ->where('name', 'Lynn Kub') |                     ->where('name', 'Lynn Kub') | ||||||
|                     ->where('phone', '555-333-4444') |                     ->where('phone', '555-333-4444') | ||||||
|                     ->where('city', 'Woodstock') |                     ->where('city', 'Woodstock') | ||||||
|                     ->where('deleted_at', null) |                     ->where('deleted_at', null) | ||||||
|                     ->has('organization', fn ($assert) => $assert |                     ->has('organization', fn (Assert $assert) => $assert | ||||||
|                         ->where('name', 'Example Organization Inc.') |                         ->where('name', 'Example Organization Inc.') | ||||||
|                     ) |                     ) | ||||||
|                 ) |                 ) | ||||||
|  | @ -86,17 +87,17 @@ class ContactsTest extends TestCase | ||||||
|     { |     { | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/contacts?search=Martin') |             ->get('/contacts?search=Martin') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Contacts/Index') |                 ->component('Contacts/Index') | ||||||
|                 ->where('filters.search', 'Martin') |                 ->where('filters.search', 'Martin') | ||||||
|                 ->has('contacts.data', 1) |                 ->has('contacts.data', 1) | ||||||
|                 ->has('contacts.data.0', fn ($assert) => $assert |                 ->has('contacts.data.0', fn (Assert $assert) => $assert | ||||||
|                     ->where('id', 1) |                     ->where('id', 1) | ||||||
|                     ->where('name', 'Martin Abbott') |                     ->where('name', 'Martin Abbott') | ||||||
|                     ->where('phone', '555-111-2222') |                     ->where('phone', '555-111-2222') | ||||||
|                     ->where('city', 'Murphyland') |                     ->where('city', 'Murphyland') | ||||||
|                     ->where('deleted_at', null) |                     ->where('deleted_at', null) | ||||||
|                     ->has('organization', fn ($assert) => $assert |                     ->has('organization', fn (Assert $assert) => $assert | ||||||
|                         ->where('name', 'Example Organization Inc.') |                         ->where('name', 'Example Organization Inc.') | ||||||
|                     ) |                     ) | ||||||
|                 ) |                 ) | ||||||
|  | @ -109,7 +110,7 @@ class ContactsTest extends TestCase | ||||||
| 
 | 
 | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/contacts') |             ->get('/contacts') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Contacts/Index') |                 ->component('Contacts/Index') | ||||||
|                 ->has('contacts.data', 1) |                 ->has('contacts.data', 1) | ||||||
|                 ->where('contacts.data.0.name', 'Lynn Kub') |                 ->where('contacts.data.0.name', 'Lynn Kub') | ||||||
|  | @ -122,7 +123,7 @@ class ContactsTest extends TestCase | ||||||
| 
 | 
 | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/contacts?trashed=with') |             ->get('/contacts?trashed=with') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Contacts/Index') |                 ->component('Contacts/Index') | ||||||
|                 ->has('contacts.data', 2) |                 ->has('contacts.data', 2) | ||||||
|                 ->where('contacts.data.0.name', 'Martin Abbott') |                 ->where('contacts.data.0.name', 'Martin Abbott') | ||||||
|  |  | ||||||
|  | @ -5,6 +5,7 @@ namespace Tests\Feature; | ||||||
| use App\Models\Account; | use App\Models\Account; | ||||||
| use App\Models\User; | use App\Models\User; | ||||||
| use Illuminate\Foundation\Testing\RefreshDatabase; | use Illuminate\Foundation\Testing\RefreshDatabase; | ||||||
|  | use Inertia\Testing\Assert; | ||||||
| use Tests\TestCase; | use Tests\TestCase; | ||||||
| 
 | 
 | ||||||
| class OrganizationsTest extends TestCase | class OrganizationsTest extends TestCase | ||||||
|  | @ -50,17 +51,17 @@ class OrganizationsTest extends TestCase | ||||||
|     { |     { | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/organizations') |             ->get('/organizations') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Organizations/Index') |                 ->component('Organizations/Index') | ||||||
|                 ->has('organizations.data', 2) |                 ->has('organizations.data', 2) | ||||||
|                 ->has('organizations.data.0', fn ($assert) => $assert |                 ->has('organizations.data.0', fn (Assert $assert) => $assert | ||||||
|                     ->where('id', 1) |                     ->where('id', 1) | ||||||
|                     ->where('name', 'Apple') |                     ->where('name', 'Apple') | ||||||
|                     ->where('phone', '647-943-4400') |                     ->where('phone', '647-943-4400') | ||||||
|                     ->where('city', 'Toronto') |                     ->where('city', 'Toronto') | ||||||
|                     ->where('deleted_at', null) |                     ->where('deleted_at', null) | ||||||
|                 ) |                 ) | ||||||
|                 ->has('organizations.data.1', fn ($assert) => $assert |                 ->has('organizations.data.1', fn (Assert $assert) => $assert | ||||||
|                     ->where('id', 2) |                     ->where('id', 2) | ||||||
|                     ->where('name', 'Microsoft') |                     ->where('name', 'Microsoft') | ||||||
|                     ->where('phone', '877-568-2495') |                     ->where('phone', '877-568-2495') | ||||||
|  | @ -74,11 +75,11 @@ class OrganizationsTest extends TestCase | ||||||
|     { |     { | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/organizations?search=Apple') |             ->get('/organizations?search=Apple') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Organizations/Index') |                 ->component('Organizations/Index') | ||||||
|                 ->where('filters.search', 'Apple') |                 ->where('filters.search', 'Apple') | ||||||
|                 ->has('organizations.data', 1) |                 ->has('organizations.data', 1) | ||||||
|                 ->has('organizations.data.0', fn ($assert) => $assert |                 ->has('organizations.data.0', fn (Assert $assert) => $assert | ||||||
|                     ->where('id', 1) |                     ->where('id', 1) | ||||||
|                     ->where('name', 'Apple') |                     ->where('name', 'Apple') | ||||||
|                     ->where('phone', '647-943-4400') |                     ->where('phone', '647-943-4400') | ||||||
|  | @ -94,7 +95,7 @@ class OrganizationsTest extends TestCase | ||||||
| 
 | 
 | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/organizations') |             ->get('/organizations') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Organizations/Index') |                 ->component('Organizations/Index') | ||||||
|                 ->has('organizations.data', 1) |                 ->has('organizations.data', 1) | ||||||
|                 ->where('organizations.data.0.name', 'Apple') |                 ->where('organizations.data.0.name', 'Apple') | ||||||
|  | @ -107,7 +108,7 @@ class OrganizationsTest extends TestCase | ||||||
| 
 | 
 | ||||||
|         $this->actingAs($this->user) |         $this->actingAs($this->user) | ||||||
|             ->get('/organizations?trashed=with') |             ->get('/organizations?trashed=with') | ||||||
|             ->assertInertia(fn ($assert) => $assert |             ->assertInertia(fn (Assert $assert) => $assert | ||||||
|                 ->component('Organizations/Index') |                 ->component('Organizations/Index') | ||||||
|                 ->has('organizations.data', 2) |                 ->has('organizations.data', 2) | ||||||
|                 ->where('organizations.data.0.name', 'Apple') |                 ->where('organizations.data.0.name', 'Apple') | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Claudio Dekker
						Claudio Dekker