Implement test

This commit is contained in:
Marcus Moore 2024-02-27 11:12:35 -08:00
parent 29d729171c
commit 69022bb8b6
No known key found for this signature in database

View file

@ -150,20 +150,18 @@ class AssetCheckinTest extends TestCase
public function testCheckinTimeAndActionLogNoteCanBeSet() public function testCheckinTimeAndActionLogNoteCanBeSet()
{ {
$this->markTestIncomplete(
'checkin_at currently takes a date and applies a time which is not inline with what the web controller does.'
);
Event::fake(); Event::fake();
$this->actingAsForApi(User::factory()->checkinAssets()->create()) $this->actingAsForApi(User::factory()->checkinAssets()->create())
->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()), [ ->postJson(route('api.asset.checkin', Asset::factory()->assignedToUser()->create()), [
'checkin_at' => '2023-01-02 12:34:56', // time is appended to the provided date in controller
'checkin_at' => '2023-01-02',
'note' => 'hi there', 'note' => 'hi there',
]); ]);
Event::assertDispatched(function (CheckoutableCheckedIn $event) { Event::assertDispatched(function (CheckoutableCheckedIn $event) {
return $event->action_date === '2023-01-02 12:34:56' && $event->note === 'hi there'; return Carbon::parse('2023-01-02')->isSameDay(Carbon::parse($event->action_date))
&& $event->note === 'hi there';
}, 1); }, 1);
} }
} }