Skip to content

A free open source IT asset/license management system

Add failing test

Marcus Moore675717ff82b3
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();