Skip to content

Commit

Permalink
✅ updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
afariasfermin committed Jan 30, 2023
1 parent 03fb53d commit 4645b43
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/Feature/InspectionAnnotationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,29 @@
it('can reset the component state', function () {
$user = User::factory()->withPersonalTeam()->create();
$inspection = Inspection::factory()->create();
$annotation = Annotation::factory()->create([
'user_id' => $user->id,
'annotable_type' => Inspection::class,
'annotable_id' => $inspection->id,
'content' => faker()->text(),
'custom_properties' => [
'status' => 'to_do',
'priority' => 'low',
'assignees' => [],
'commissioning_at' => Carbon::now()->toDateString(),
],
]);
$state = [...$annotation->toArray()];
$state['annotation_id'] = $annotation->id;
$this->actingAs($user)
->livewire(InspectionAnnotations::class, ['inspection' => $inspection])
->assertViewIs('livewire.inspection-annotations')
->set('state', $state)
->call('resetState')
->assertSet('password', '')
->assertSet('confirmingAnnotationDeletion', false)
->assertSet('displayOverlayPane', false)
->assertSet('suggestions', $user->currentTeam->users)
->assertSet('suggestions', collect([]))
->assertSet('state', [
'user_id' => $user->id,
'annotation_id' => null,
Expand All @@ -250,8 +265,8 @@
'priority' => '',
'commissioning_at' => null,
'feature' => [
'values' => null,
'geometry' => null,
'values' => [],
'geometry' => [],
]
]
])
Expand Down

0 comments on commit 4645b43

Please sign in to comment.