Skip to content

Commit

Permalink
Update competitors resource test #2
Browse files Browse the repository at this point in the history
  • Loading branch information
drewroberts committed Mar 24, 2021
1 parent 949df8f commit f24c038
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/Feature/Nova/CompetitorResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@
class CompetitorResourceTest extends TestCase
{
use DatabaseTransactions;


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

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

$this->actingAs(self::createPermissionedUser('view competitors', 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/competitors')
$response = $this->getJson(self::NOVA_ROUTE)
->assertOk();

$this->assertCount(4, $response->json('resources'));
$this->assertCount(3, $response->json('resources'));
}
}

0 comments on commit f24c038

Please sign in to comment.