Revert unneeded changes

This commit is contained in:
Marcus Moore 2023-06-26 14:01:09 -07:00
parent 7cb22d3d49
commit 2abdb8a5fd
No known key found for this signature in database
2 changed files with 12 additions and 14 deletions

View file

@ -5,6 +5,7 @@ namespace Tests\Feature\Api\Users;
use App\Models\Company;
use App\Models\User;
use Illuminate\Testing\Fluent\AssertableJson;
use Laravel\Passport\Passport;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
@ -16,8 +17,8 @@ class UsersForSelectListTest extends TestCase
{
$users = User::factory()->superuser()->count(3)->create();
$this->actingAsForApi($users->first())
->getJson(route('api.users.selectlist'))
Passport::actingAs($users->first());
$this->getJson(route('api.users.selectlist'))
->assertOk()
->assertJsonStructure([
'results',
@ -33,9 +34,8 @@ class UsersForSelectListTest extends TestCase
{
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
$response = $this->actingAsForApi(User::factory()->create())
->getJson(route('api.users.selectlist', ['search' => 'luke sky']))
->assertOk();
Passport::actingAs(User::factory()->create());
$response = $this->getJson(route('api.users.selectlist', ['search' => 'luke sky']))->assertOk();
$results = collect($response->json('results'));
@ -57,9 +57,8 @@ class UsersForSelectListTest extends TestCase
->has(User::factory()->state(['first_name' => 'Darth', 'last_name' => 'Vader', 'username' => 'dvader']))
->create();
$response = $this->actingAsForApi($jedi->users->first())
->getJson(route('api.users.selectlist'))
->assertOk();
Passport::actingAs($jedi->users->first());
$response = $this->getJson(route('api.users.selectlist'))->assertOk();
$results = collect($response->json('results'));
@ -86,9 +85,8 @@ class UsersForSelectListTest extends TestCase
->has(User::factory()->state(['first_name' => 'Darth', 'last_name' => 'Vader', 'username' => 'dvader']))
->create();
$response = $this->actingAsForApi($jedi->users->first())
->getJson(route('api.users.selectlist', ['search' => 'a']))
->assertOk();
Passport::actingAs($jedi->users->first());
$response = $this->getJson(route('api.users.selectlist', ['search' => 'a']))->assertOk();
$results = collect($response->json('results'));

View file

@ -3,6 +3,7 @@
namespace Tests\Feature\Api\Users;
use App\Models\User;
use Laravel\Passport\Passport;
use Tests\Support\InteractsWithSettings;
use Tests\TestCase;
@ -15,9 +16,8 @@ class UsersSearchTest extends TestCase
User::factory()->create(['first_name' => 'Luke', 'last_name' => 'Skywalker']);
User::factory()->create(['first_name' => 'Darth', 'last_name' => 'Vader']);
$response = $this->actingAsForApi(User::factory()->viewUsers()->create())
->getJson(route('api.users.index', ['search' => 'luke sky']))
->assertOk();
Passport::actingAs(User::factory()->viewUsers()->create());
$response = $this->getJson(route('api.users.index', ['search' => 'luke sky']))->assertOk();
$results = collect($response->json('rows'));