From 832e50a71ebcda26451f090042cb072bae05c4f3 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 18 Sep 2024 11:19:41 -0700 Subject: [PATCH] Implement test --- tests/Feature/Checkins/Api/AccessoryCheckinTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Feature/Checkins/Api/AccessoryCheckinTest.php b/tests/Feature/Checkins/Api/AccessoryCheckinTest.php index fd0fc075f..58c551419 100644 --- a/tests/Feature/Checkins/Api/AccessoryCheckinTest.php +++ b/tests/Feature/Checkins/Api/AccessoryCheckinTest.php @@ -45,4 +45,17 @@ class AccessoryCheckinTest extends TestCase implements TestsFullMultipleCompanie $this->assertEquals(1, $accessoryForCompanyB->fresh()->checkouts->count(), 'Accessory should not be checked in'); $this->assertEquals(0, $anotherAccessoryForCompanyB->fresh()->checkouts->count(), 'Accessory should be checked in'); } + + public function testCanCheckinAccessory() + { + $accessory = Accessory::factory()->checkedOutToUser()->create(); + + $this->assertEquals(1, $accessory->checkouts->count()); + + $this->actingAsForApi(User::factory()->checkinAccessories()->create()) + ->postJson(route('api.accessories.checkin', $accessory)) + ->assertStatusMessageIs('success'); + + $this->assertEquals(0, $accessory->fresh()->checkouts->count(), 'Accessory should be checked in'); + } }