diff --git a/tests/Feature/AssetModels/Ui/AssetModelIndexTest.php b/tests/Feature/AssetModels/Ui/AssetModelIndexTest.php new file mode 100644 index 0000000000..a73d425723 --- /dev/null +++ b/tests/Feature/AssetModels/Ui/AssetModelIndexTest.php @@ -0,0 +1,23 @@ +actingAs(User::factory()->create()) + ->get(route('models.index')) + ->assertForbidden(); + } + + public function testUserCanListAssetModels() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get(route('models.index')) + ->assertOk(); + } +} diff --git a/tests/Feature/AssetModels/Ui/AssetModelStoreTest.php b/tests/Feature/AssetModels/Ui/AssetModelStoreTest.php new file mode 100644 index 0000000000..81b07237c0 --- /dev/null +++ b/tests/Feature/AssetModels/Ui/AssetModelStoreTest.php @@ -0,0 +1,35 @@ +actingAs(User::factory()->create()) + ->post(route('models.store'), [ + 'name' => 'Test Model', + 'category_id' => Category::factory()->create()->id + ]) + ->assertForbidden(); + } + + public function testUserCanCreateAssetModels() + { + $this->assertFalse(AssetModel::where('name', 'Test Model')->exists()); + + $this->actingAs(User::factory()->superuser()->create()) + ->post(route('models.store'), [ + 'name' => 'Test Model', + 'category_id' => Category::factory()->create()->id + ]) + ->assertRedirect(route('models.index')); + + $this->assertTrue(AssetModel::where('name', 'Test Model')->exists()); + } +} diff --git a/tests/Feature/AssetModels/Ui/AssetModelsTest.php b/tests/Feature/AssetModels/Ui/AssetModelsTest.php deleted file mode 100644 index bb60a25fe5..0000000000 --- a/tests/Feature/AssetModels/Ui/AssetModelsTest.php +++ /dev/null @@ -1,38 +0,0 @@ -actingAs(User::factory()->superuser()->create()) - ->get(route('models.index')) - ->assertStatus(200); - - } - - public function testUserCanCreateAssetModels() - { - $this->actingAs(User::factory()->superuser()->create()) - ->post(route('models.index'), [ - 'name' => 'Test Model', - 'category_id' => Category::factory()->create()->id - ]) - ->assertStatus(302) - ->assertRedirect(route('models.index')); - } - - -}