This commit is contained in:
@@ -136,6 +136,25 @@ test('selection is cleared on withdrawal logout and account mismatch and malform
|
||||
expect(CandidateAccount::query()->count())->toBe($count);
|
||||
});
|
||||
|
||||
test('all own receipts remain reachable with frozen titles and independent pagination without exposing another candidate', function () {
|
||||
$this->postJson($this->base.'/oportunidades/'.$this->process->id, $this->body)->assertRedirect();
|
||||
$receipt = (array) DB::table('candidate_submissions')->sole();
|
||||
$process = (array) DB::table('people_processes')->where('id', $this->process->id)->first();
|
||||
unset($receipt['id'], $process['id']);
|
||||
$snapshot = json_decode($receipt['snapshot'], true, 32, JSON_THROW_ON_ERROR);
|
||||
$snapshot['opportunity']['title'] = 'Título preservado no comprovativo';
|
||||
for ($index = 0; $index < 20; $index++) {
|
||||
$id = DB::table('people_processes')->insertGetId([...$process, 'operation_key' => (string) Str::uuid(), 'title' => 'Outro título actual do processo']);
|
||||
DB::table('candidate_submissions')->insert([...$receipt, 'people_process_id' => $id, 'operation_key' => (string) Str::uuid(), 'reference' => 'CAND-'.Str::uuid(), 'snapshot' => json_encode($snapshot, JSON_THROW_ON_ERROR)]);
|
||||
}
|
||||
$foreign = app(CandidateProfiles::class)->register($this->tenant->id, [...$this->credentials, 'email' => 'private-receipt@example.invalid']);
|
||||
DB::table('candidate_submissions')->insert([...$receipt, 'candidate_account_id' => $foreign->id, 'operation_key' => (string) Str::uuid(), 'reference' => 'CAND-PRIVADO']);
|
||||
$this->get($this->base.'/perfil')->assertInertia(fn (Assert $p) => $p->has('submissions', 12)->where('submissionPagination.total', 21)->where('submissions.0.title', 'Título preservado no comprovativo')->missing('submissions.0.snapshot')->missing('submissions.0.candidate_account_id'));
|
||||
$this->get($this->base.'/perfil?submissions_page=2&opportunities_page=2')->assertInertia(fn (Assert $p) => $p->has('submissions', 9)->where('submissionPagination.total', 21)
|
||||
->where('submissionPagination.prev', fn ($url) => str_contains($url, 'opportunities_page=2') && str_contains($url, 'submissions_page=1'))->where('submissionPagination.next', null));
|
||||
$this->getJson($this->base.'/perfil?submissions_page=-1')->assertUnprocessable();
|
||||
});
|
||||
|
||||
test('electronic submission returns a scoped receipt and preserves the actual profile and answers', function () {
|
||||
$this->get($this->base.'/oportunidades/'.$this->process->id)->assertInertia(fn (Assert $p) => $p->where('opportunity.description', 'Descrição pública fictícia da oportunidade.')->missing('opportunity.purpose')->missing('opportunity.selection'));
|
||||
$url = $this->base.'/oportunidades/'.$this->process->id;
|
||||
|
||||
Reference in New Issue
Block a user