fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -36,10 +36,10 @@ class ReferenceCatalogTest extends TestCase
|
||||
{
|
||||
$this->seedReferences();
|
||||
|
||||
$this->getJson('/api/v1/catalogs/economic-activities?q=energia&per_page=1')
|
||||
$this->getJson('/api/v1/catalogs/economic-activities?q=turismo&per_page=1')
|
||||
->assertOk()->assertJsonPath('meta.version', 1)->assertJsonPath('meta.locale', 'pt-MZ')
|
||||
->assertJsonPath('meta.total', 1)->assertJsonPath('data.0.code', 'energia')
|
||||
->assertJsonPath('data.0.label', DB::table('sectors')->where('slug', 'energia')->value('name'));
|
||||
->assertJsonPath('meta.total', 1)->assertJsonPath('data.0.code', 'turismo')
|
||||
->assertJsonPath('data.0.label', DB::table('sectors')->where('slug', 'turismo')->value('name'));
|
||||
|
||||
$this->getJson('/api/v1/catalogs/economic-activities?version=1&per_page=2&page=2')
|
||||
->assertOk()->assertJsonPath('meta.current_page', 2)->assertJsonPath('meta.total', 6)
|
||||
@@ -66,10 +66,10 @@ class ReferenceCatalogTest extends TestCase
|
||||
public function test_economic_activity_dropdown_can_be_filtered_by_sector(): void
|
||||
{
|
||||
$this->seedReferences();
|
||||
$sectorId = DB::table('sectors')->where('slug', 'energia')->value('id');
|
||||
$sectorId = DB::table('sectors')->where('slug', 'turismo')->value('id');
|
||||
|
||||
$this->getJson('/api/v1/catalogs/economic-activities?sector_id='.$sectorId)
|
||||
->assertOk()->assertJsonPath('meta.total', 1)->assertJsonPath('data.0.code', 'energia');
|
||||
->assertOk()->assertJsonPath('meta.total', 1)->assertJsonPath('data.0.code', 'turismo');
|
||||
$this->getJson('/api/v1/catalogs/economic-activities?sector_id=999999999')
|
||||
->assertUnprocessable()->assertJsonValidationErrors('sector_id');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user