Receber documentos privados e locais de disponibilidade nas candidaturas
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -4,6 +4,7 @@ import { renderToString } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import Entry from '@/pages/candidate/entry';
|
||||
import Profile from '@/pages/candidate/profile';
|
||||
import { CandidateAvailability } from '@/components/candidate-availability';
|
||||
|
||||
const page = {
|
||||
component: 'candidate/entry',
|
||||
@@ -13,6 +14,30 @@ const page = {
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
} satisfies Page;
|
||||
|
||||
test('received availability renders primary and additional locations without requiring a new profile format', () => {
|
||||
const availability = {
|
||||
province: 'Província A',
|
||||
district: 'Distrito A',
|
||||
locality: 'Localidade A',
|
||||
};
|
||||
const additional = {
|
||||
province: 'Província B',
|
||||
district: 'Distrito B',
|
||||
locality: 'Localidade B',
|
||||
};
|
||||
const html = renderToString(
|
||||
<CandidateAvailability
|
||||
data={{ availability, additional_availability: [additional] }}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('Localidade A');
|
||||
expect(html).toContain('Localidade B');
|
||||
expect(
|
||||
renderToString(<CandidateAvailability data={{ availability }} />),
|
||||
).toContain('Localidade A');
|
||||
expect(renderToString(<CandidateAvailability />)).toBe('');
|
||||
});
|
||||
test.each([true, false])(
|
||||
'registration availability (%s) preserves existing login and does not promise submission',
|
||||
(registration_open) => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { expect, test } from 'vitest';
|
||||
import Opportunity from '@/pages/candidate/opportunity';
|
||||
import Receipt from '@/pages/candidate/receipt';
|
||||
import Access from '@/pages/candidate/access';
|
||||
import { CandidateDocumentList } from '@/components/candidate-documents';
|
||||
|
||||
const page = {
|
||||
component: 'candidate/opportunity',
|
||||
@@ -29,8 +30,42 @@ const definition = {
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
documents: [],
|
||||
documents: [
|
||||
{
|
||||
key: 'cv',
|
||||
label: 'Currículo obrigatório',
|
||||
required: true,
|
||||
formats: ['pdf', 'docx'],
|
||||
max_kb: 1024,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
test('received files use guarded download links and retain their fingerprint without a storage URL', () => {
|
||||
const html = renderToString(
|
||||
<CandidateDocumentList
|
||||
baseUrl="/candidaturas/1/submissoes/7"
|
||||
documents={{
|
||||
cv: {
|
||||
key: 'cv',
|
||||
name: 'curriculo.pdf',
|
||||
size: 2048,
|
||||
sha256: 'abc123',
|
||||
verification: 'format_checked',
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('/candidaturas/1/submissoes/7/documentos/cv');
|
||||
expect(html).toContain('abc123');
|
||||
expect(html).toContain('autenticidade dependem da análise documental');
|
||||
expect(html).not.toContain('/storage/');
|
||||
expect(
|
||||
renderToString(
|
||||
<CandidateDocumentList baseUrl="/unused" documents={[]} />,
|
||||
),
|
||||
).toBe('');
|
||||
});
|
||||
test.each([true, false])(
|
||||
'actual submission form reuses geographic profile and requires email confirmation (%s)',
|
||||
(emailVerified) => {
|
||||
@@ -54,6 +89,13 @@ test.each([true, false])(
|
||||
data: {
|
||||
name: 'Nome do perfil',
|
||||
summary: 'Perfil fictício',
|
||||
additional_availability: [
|
||||
{
|
||||
province: 'Outra província',
|
||||
district: 'Outro distrito',
|
||||
locality: 'Outra localidade',
|
||||
},
|
||||
],
|
||||
availability: {
|
||||
province: 'Província do perfil',
|
||||
district: 'Distrito do perfil',
|
||||
@@ -68,6 +110,11 @@ test.each([true, false])(
|
||||
);
|
||||
expect(html).toContain('value="Nome do perfil"');
|
||||
expect(html).toContain('value="Distrito do perfil"');
|
||||
expect(html).toContain('Usar local guardado no perfil');
|
||||
expect(html).toContain('Outra localidade');
|
||||
expect(html).toContain('type="file"');
|
||||
expect(html).toContain('Currículo obrigatório');
|
||||
expect(html).toContain('accept=".pdf,.docx"');
|
||||
expect(html).toContain('Submeter candidatura e obter comprovativo');
|
||||
expect(html.includes('disabled=""')).toBe(!emailVerified);
|
||||
},
|
||||
|
||||
@@ -9,10 +9,7 @@ import { procurementNavigation } from '@/lib/procurement-navigation';
|
||||
|
||||
const fixtures = JSON.parse(
|
||||
readFileSync(
|
||||
new URL(
|
||||
'../../storage/app/private/public-navigation-fixtures.json',
|
||||
import.meta.url,
|
||||
),
|
||||
new URL('../Fixtures/public-navigation.json', import.meta.url),
|
||||
'utf8',
|
||||
),
|
||||
) as Record<string, Page>;
|
||||
|
||||
Reference in New Issue
Block a user