fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Tests\Feature;
|
||||
use App\Models\Opportunity;
|
||||
use App\Models\Sector;
|
||||
use App\Services\SectorInvestment;
|
||||
use App\Services\SectorOrganization;
|
||||
use App\Support\IsolatedQaDatabase;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
@@ -51,7 +52,7 @@ class SectorCatalogueContentTest extends TestCase
|
||||
$ids = array_column($props['sectors'], 'id');
|
||||
$this->assertSame($ids, array_values(array_unique($ids)));
|
||||
foreach ($props['sectors'] as $card) {
|
||||
$this->assertSame(\App\Services\SectorOrganization::href($card['slug']), $card['url']);
|
||||
$this->assertSame(SectorOrganization::href($card['slug']), $card['url']);
|
||||
$this->assertStringNotContainsString('#', $card['url']);
|
||||
$single = $this->get($card['url'])->assertOk()->inertiaProps();
|
||||
$this->assertSame('sector', $single['section']);
|
||||
@@ -64,7 +65,7 @@ class SectorCatalogueContentTest extends TestCase
|
||||
}
|
||||
$entry = $this->get('/sectores/'.$withoutGuide->slug)->assertOk()->inertiaProps()['sectorEntry'];
|
||||
$this->assertSame([], $entry['articles']);
|
||||
$this->assertSame('/minhas-oportunidades/create?sector_id='.$withoutGuide->id, $entry['register_href']);
|
||||
$this->assertSame('/perfil/promotor', $entry['register_href']);
|
||||
$this->assertNotNull($entry['start_href']);
|
||||
$this->assertGuest();
|
||||
$this->assertSame($before, [DB::table('desk_cases')->count(), DB::table('opportunities')->count(), DB::table('portal_resources')->count()]);
|
||||
@@ -98,13 +99,15 @@ class SectorCatalogueContentTest extends TestCase
|
||||
$this->get('/sectores/'.$unpublished->slug)->assertNotFound();
|
||||
$this->get('/sectores/'.$inactive->slug)->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_selecting_a_sector_keeps_opportunities_scoped_on_reload_and_return(): void
|
||||
{
|
||||
$a = $this->sector();$b = $this->sector();
|
||||
$a = $this->sector();
|
||||
$b = $this->sector();
|
||||
foreach ([$a, $b] as $sector) {
|
||||
$slug = 'qa-isolated-'.Str::lower(Str::random(12));
|
||||
Opportunity::create(['sector_id'=>$sector->id, 'reference'=>$slug, 'title'=>$slug, 'slug'=>$slug,
|
||||
'summary'=>'Synthetic scoped opportunity', 'status'=>'published', 'published_at'=>now()->subDay()]);
|
||||
Opportunity::create(['sector_id' => $sector->id, 'reference' => $slug, 'title' => $slug, 'slug' => $slug,
|
||||
'summary' => 'Synthetic scoped opportunity', 'status' => 'published', 'published_at' => now()->subDay()]);
|
||||
}
|
||||
$index = $this->get('/sectores')->assertOk()->inertiaProps();
|
||||
foreach ([$a, $b, $a] as $sector) {
|
||||
@@ -114,7 +117,7 @@ class SectorCatalogueContentTest extends TestCase
|
||||
$this->assertSame($first['sector'], $reload['sector']);
|
||||
$this->assertSame($first['opportunities'], $reload['opportunities']);
|
||||
$this->assertSame($sector->id, $first['sector']['id']);
|
||||
$this->assertSame(Opportunity::where('sector_id',$sector->id)->pluck('slug')->all(), array_column($first['opportunities'],'slug'));
|
||||
$this->assertSame(Opportunity::where('sector_id', $sector->id)->pluck('slug')->all(), array_column($first['opportunities'], 'slug'));
|
||||
$this->assertSame('/investimentos/a-partir-do-setor/'.$sector->slug, $first['sectorEntry']['start_href']);
|
||||
$this->get($first['sectorEntry']['start_href'])->assertRedirect('/login');
|
||||
$returned = $this->get('/sectores')->assertOk()->inertiaProps();
|
||||
@@ -122,5 +125,4 @@ class SectorCatalogueContentTest extends TestCase
|
||||
$this->assertArrayNotHasKey('sectorDetails', $returned);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user