From d635c86e0096825f46993310facfba8b05a47822 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 28 Aug 2024 12:46:30 +0100 Subject: [PATCH] Added tests Signed-off-by: snipe --- .../Api/DepreciationsIndexTest.php | 17 ++++++++++++++ .../Ui/DepreciationsIndexTest.php | 23 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/Feature/Depreciations/Api/DepreciationsIndexTest.php create mode 100644 tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php diff --git a/tests/Feature/Depreciations/Api/DepreciationsIndexTest.php b/tests/Feature/Depreciations/Api/DepreciationsIndexTest.php new file mode 100644 index 000000000..29583001a --- /dev/null +++ b/tests/Feature/Depreciations/Api/DepreciationsIndexTest.php @@ -0,0 +1,17 @@ +actingAsForApi(User::factory()->create()) + ->getJson(route('api.departments.index')) + ->assertForbidden(); + } + +} diff --git a/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php b/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php new file mode 100644 index 000000000..90cb39b4e --- /dev/null +++ b/tests/Feature/Depreciations/Ui/DepreciationsIndexTest.php @@ -0,0 +1,23 @@ +actingAs(User::factory()->create()) + ->get(route('depreciations.index')) + ->assertForbidden(); + } + + public function testUserCanListDepreciations() + { + $this->actingAs(User::factory()->admin()->create()) + ->get(route('depreciations.index')) + ->assertOk(); + } +}