From 675717ff82b3e30ba7e76cbe4cec25def5615c0d Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 25 Mar 2024 13:46:22 -0700 Subject: [PATCH] Add failing test --- tests/Feature/Api/Assets/AssetStoreTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Feature/Api/Assets/AssetStoreTest.php b/tests/Feature/Api/Assets/AssetStoreTest.php index 4b4f66f3df..e98da36cf9 100644 --- a/tests/Feature/Api/Assets/AssetStoreTest.php +++ b/tests/Feature/Api/Assets/AssetStoreTest.php @@ -113,6 +113,20 @@ class AssetStoreTest extends TestCase $this->assertNull($asset->last_audit_date); } + public function testNonDateUsedForLastAuditDateReturnsValidationError() + { + $response = $this->actingAsForApi(User::factory()->superuser()->create()) + ->postJson(route('api.assets.store'), [ + 'last_audit_date' => 'this-is-not-valid', + 'asset_tag' => '1234', + 'model_id' => AssetModel::factory()->create()->id, + 'status_id' => Statuslabel::factory()->create()->id, + ]) + ->assertStatusMessageIs('error'); + + $this->assertNotNull($response->json('messages.last_audit_date')); + } + public function testArchivedDepreciateAndPhysicalCanBeNull() { $model = AssetModel::factory()->ipadModel()->create();