Added tests

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-28 12:46:30 +01:00
parent 406ff6984b
commit d635c86e00
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<?php
namespace Tests\Feature\Depreciations\Api;
use App\Models\User;
use Tests\TestCase;
class DepreciationsIndexTest extends TestCase
{
public function testViewingDepreciationIndexRequiresPermission()
{
$this->actingAsForApi(User::factory()->create())
->getJson(route('api.departments.index'))
->assertForbidden();
}
}

View file

@ -0,0 +1,23 @@
<?php
namespace Tests\Feature\Categories\Ui;
use App\Models\User;
use Tests\TestCase;
class DepreciationsIndexTest extends TestCase
{
public function testPermissionRequiredToViewDepreciationsList()
{
$this->actingAs(User::factory()->create())
->get(route('depreciations.index'))
->assertForbidden();
}
public function testUserCanListDepreciations()
{
$this->actingAs(User::factory()->admin()->create())
->get(route('depreciations.index'))
->assertOk();
}
}