@@ -35,6 +35,7 @@ function render(
|
||||
authorised_at: string;
|
||||
reason: string;
|
||||
} | null = null,
|
||||
overrides: Record<string, unknown> = {},
|
||||
) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
@@ -67,11 +68,37 @@ function render(
|
||||
},
|
||||
suppliers: [{ id: 1, name: 'Synthetic supplier' }],
|
||||
requisitions: [],
|
||||
...overrides,
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
test('declaration list distinguishes a released chain from an active independent impediment without changing the original statement', () => {
|
||||
const post = vi.spyOn(router, 'post');
|
||||
const html = render(false, 7, 4, 'finance', true, 3, false, null, {
|
||||
declarations: {
|
||||
data: [
|
||||
declaration,
|
||||
{ ...declaration, id: 4, previous_id: 3, root_id: 3 },
|
||||
{ ...declaration, id: 5 },
|
||||
{ ...declaration, id: 6, has_conflict: false },
|
||||
],
|
||||
prev_page_url: null,
|
||||
next_page_url: null,
|
||||
},
|
||||
releasedRoots: [3],
|
||||
});
|
||||
expect(html.match(/Impedimento levantado pela direcção/g)).toHaveLength(2);
|
||||
expect(html.match(/Impedimento activo/g)).toHaveLength(1);
|
||||
expect(html.match(/Conflito registado/g)).toHaveLength(3);
|
||||
expect(html).toContain('Ausência declarada');
|
||||
expect(html).toContain('autorização expressa da direcção');
|
||||
expect(html).not.toContain('nem retirada de conflitos nesta etapa');
|
||||
expect(html).not.toContain('os restantes perfis consultam apenas');
|
||||
expect(post).not.toHaveBeenCalled();
|
||||
});
|
||||
test('direction release preparation requires explicit capability and never submits on recovery', () => {
|
||||
vi.spyOn(router, 'restore').mockImplementation((key) =>
|
||||
key ===
|
||||
|
||||
Reference in New Issue
Block a user