Skip to content

Commit

Permalink
Update snapshot resource test #2
Browse files Browse the repository at this point in the history
  • Loading branch information
drewroberts committed Mar 24, 2021
1 parent f24c038 commit dba7944
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/Feature/Nova/SnapshotResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@
class SnapshotResourceTest extends TestCase
{
use DatabaseTransactions;


private const NOVA_ROUTE = 'nova-api/snapshots';

/** @test */
public function index()
{
Snapshot::factory()->count(4)->create();

$this->actingAs(self::createPermissionedUser('view snapshots', true));
/** @var User $user */
$user = User::factory()->create()->givePermissionTo(
Role::findByName('Admin')->getPermissionNames() // Use individual permissions so we can revoke one
);
$this->actingAs($user);

$response = $this->getJson('nova-api/snapshots')
$response = $this->getJson(self::NOVA_ROUTE)
->assertOk();

$this->assertCount(4, $response->json('resources'));
Expand Down

0 comments on commit dba7944

Please sign in to comment.