Implement test

This commit is contained in:
Marcus Moore 2024-09-18 11:19:41 -07:00
parent fa19686248
commit 832e50a71e
No known key found for this signature in database

View file

@ -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');
}
}