fix(sector): use effective creation access and preserve corridor presentation contract
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -20,6 +20,10 @@ final class InvestorUsabilityScopeTest extends TestCase
|
||||
$actor=User::factory()->create();
|
||||
$this->actingAs($actor)->get('/sectores/turismo')->assertOk();
|
||||
$this->assertSame(0,DB::table('portal_role_assignments')->where('user_id',$actor->id)->count());
|
||||
config(['portal.profile_access_enabled'=>true]);
|
||||
$entry=app(\App\Services\SectorInvestment::class)->publicView(\App\Models\Sector::where('slug','turismo')->firstOrFail());
|
||||
$this->assertSame('/perfil/promotor',$entry['register_href']);
|
||||
$this->assertSame('Pedir acesso para cadastrar oportunidades',$entry['register_label']);
|
||||
}
|
||||
|
||||
public function test_zones_all_equals_visible_set_and_province_and_district_never_fall_back_to_all():void
|
||||
|
||||
@@ -24,6 +24,10 @@ class OpportunityCorridorExplorerTest extends TestCase
|
||||
$catalogue->shouldReceive('query')->with($filters)->once()->andReturn($query);
|
||||
$catalogue->shouldReceive('context')->with(101)->once()->andReturn(['corridors' => collect([(object)['id'=>'a','name'=>'Corredor A'],(object)['id'=>'b','name'=>'Corredor B']])]);
|
||||
$catalogue->shouldReceive('context')->with(102)->once()->andReturn(['corridors'=>collect()]);
|
||||
$first->setAttribute('territorial_summary','Sofala / Dondo');
|
||||
$other->setAttribute('territorial_summary','Localização não indicada');
|
||||
$catalogue->shouldReceive('presentLocation')->with($first)->once()->andReturn($first);
|
||||
$catalogue->shouldReceive('presentLocation')->with($other)->once()->andReturn($other);
|
||||
$this->app->instance(InvestmentCatalogue::class, $catalogue);
|
||||
$groups = app(OpportunityCorridorExplorer::class)->groups($filters);
|
||||
$this->assertSame(['Corredor A','Corredor B','Outras localizações'], array_column($groups,'name'));
|
||||
@@ -32,5 +36,6 @@ class OpportunityCorridorExplorerTest extends TestCase
|
||||
$this->assertSame(['Sofala / Dondo'], $groups[0]['locations']);
|
||||
$this->assertSame([], $groups[2]['locations']);
|
||||
$this->assertSame([], $groups[0]['opportunities'][0]['stages']);
|
||||
$this->assertSame('Sofala / Dondo',$groups[0]['opportunities'][0]['territorial_summary']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {opportunityFillGroups,opportunityErrorGroup,opportunityMissingGroups} from '../../resources/js/lib/opportunity-fill-flow.ts';
|
||||
import {territorialSearchParams} from '../../resources/js/lib/territorial-search-params.ts';
|
||||
import {documentFacetLabel} from '../../resources/js/lib/document-facet-label.ts';
|
||||
|
||||
test('adaptive groups keep every applicable schema field once, including new specialized fields',()=>{
|
||||
const keys=['official_title','locations','sector_id','documents','currency','real_estate','future_schema_field','currency'];
|
||||
@@ -26,3 +27,9 @@ test('territorial search replaces old descendants while retaining all selected n
|
||||
const all=territorialSearchParams(entries,[]);assert.equal(all.has('province_id'),false);assert.equal(all.get('category'),'zee');
|
||||
const unchanged=territorialSearchParams(entries);assert.equal(unchanged.get('district_id'),'old-child');
|
||||
});
|
||||
test('document facets have readable labels while original query identifiers remain unchanged',()=>{
|
||||
const original=['agronegocio','education','media','pt','turismo'];
|
||||
assert.deepEqual(original.map(documentFacetLabel),['Agronegócio','Formação e competências','Imagens e conteúdos de apoio','Português','Turismo']);
|
||||
assert.deepEqual(original,['agronegocio','education','media','pt','turismo']);
|
||||
assert.equal(documentFacetLabel('Tema definido pela Tempo'),'Tema definido pela Tempo');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user