create(['name' => 'IT']); $sub = $category->subcategories()->create(['name' => 'VPN']); $client = ApiClient::factory()->create(); Sanctum::actingAs($client, ['dictionaries:read']); $this->getJson('/api/v1/categories') ->assertOk() ->assertJsonPath('data.0.name', 'IT') ->assertJsonPath('data.0.subcategories.0.name', 'VPN'); }); test('statuses are returned ordered by sort_order', function () { seedStatusesAndPriorities(); $client = ApiClient::factory()->create(); Sanctum::actingAs($client, ['dictionaries:read']); $this->getJson('/api/v1/statuses') ->assertOk() ->assertJsonPath('data.0.key', 'new'); }); test('priorities are returned ordered by sort_order', function () { seedStatusesAndPriorities(); $client = ApiClient::factory()->create(); Sanctum::actingAs($client, ['dictionaries:read']); $this->getJson('/api/v1/priorities') ->assertOk() ->assertJsonPath('data.0.key', 'high'); }); test('teams are returned', function () { Team::query()->create(['name' => 'Infra']); $client = ApiClient::factory()->create(); Sanctum::actingAs($client, ['dictionaries:read']); $this->getJson('/api/v1/teams') ->assertOk() ->assertJsonPath('data.0.name', 'Infra'); }); test('dictionaries require the dictionaries:read ability', function () { $client = ApiClient::factory()->create(); Sanctum::actingAs($client, ['tickets:read']); $this->getJson('/api/v1/categories')->assertForbidden(); });