token = User::factory()->create()->createToken('test-token')->plainTextToken; }); test('lists active ev companies', function () { $active = EvCompany::factory()->create(['is_active' => true]); EvCompany::factory()->create(['is_active' => false]); $this->withHeader('Authorization', "Bearer {$this->token}") ->getJson('/api/v1/companies') ->assertSuccessful() ->assertJsonCount(1, 'data') ->assertJsonFragment(['id' => $active->id]); }); test('lists active destinations', function () { $active = Destination::factory()->create(['is_active' => true]); Destination::factory()->create(['is_active' => false]); $this->withHeader('Authorization', "Bearer {$this->token}") ->getJson('/api/v1/destinations') ->assertSuccessful() ->assertJsonCount(1, 'data') ->assertJsonFragment(['id' => $active->id]); }); test('companies endpoint rejects unauthenticated requests', function () { $this->getJson('/api/v1/companies')->assertUnauthorized(); }); test('destinations endpoint rejects unauthenticated requests', function () { $this->getJson('/api/v1/destinations')->assertUnauthorized(); });