@@ -3,6 +3,7 @@ import type { Page } from '@inertiajs/core';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import PeopleIndex from '@/pages/people';
|
||||
import BusinessClients from '@/pages/company/clients';
|
||||
import PeopleShow from '@/pages/people/show';
|
||||
import PeopleAccess from '@/pages/people/access';
|
||||
import { PeopleClarifications } from '@/components/people-clarifications';
|
||||
@@ -18,6 +19,79 @@ const base = {
|
||||
encryptHistory: false,
|
||||
} satisfies Page;
|
||||
|
||||
test('third party preparation identifies its client and the providers direction', () => {
|
||||
const page = {
|
||||
...base,
|
||||
props: {
|
||||
errors: {},
|
||||
ready: true,
|
||||
kinds: ['service'],
|
||||
canPrepare: ['service'],
|
||||
clientMode: true,
|
||||
clients: [
|
||||
{
|
||||
id: 12,
|
||||
code: 'CLI-12',
|
||||
name: 'Cliente identificado',
|
||||
version: 3,
|
||||
},
|
||||
],
|
||||
processes: { data: [], links: [] },
|
||||
},
|
||||
};
|
||||
const html = renderToString(
|
||||
<App initialPage={page} initialComponent={PeopleIndex} />,
|
||||
);
|
||||
expect(html).toContain('Cliente identificado');
|
||||
expect(html).toContain('name="client_id"');
|
||||
expect(html).toContain('Direcção');
|
||||
expect(html).toContain('/empresa/clientes');
|
||||
});
|
||||
|
||||
test('the client registry provides real versioned edit forms and no edit control to readers', () => {
|
||||
const props = {
|
||||
errors: {},
|
||||
filters: {},
|
||||
canManage: true,
|
||||
clients: {
|
||||
data: [
|
||||
{
|
||||
id: 12,
|
||||
client_key: 'test-key',
|
||||
code: 'CLI-12',
|
||||
name: 'Cliente identificado',
|
||||
tax_number: null,
|
||||
address: null,
|
||||
email: null,
|
||||
active: true,
|
||||
version: 3,
|
||||
},
|
||||
],
|
||||
current_page: 1,
|
||||
last_page: 1,
|
||||
prev_page_url: null,
|
||||
next_page_url: null,
|
||||
},
|
||||
};
|
||||
const html = renderToString(
|
||||
<App
|
||||
initialPage={{ ...base, props }}
|
||||
initialComponent={BusinessClients}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('/empresa/clientes/12');
|
||||
expect(html).toContain('name="version"');
|
||||
expect(html).toContain('Guardar alterações');
|
||||
const reader = renderToString(
|
||||
<App
|
||||
initialPage={{ ...base, props: { ...props, canManage: false } }}
|
||||
initialComponent={BusinessClients}
|
||||
/>,
|
||||
);
|
||||
expect(reader).toContain('Cliente identificado');
|
||||
expect(reader).not.toContain('Guardar alterações');
|
||||
});
|
||||
|
||||
test('operational reading explains its scope and missing deadlines without suggesting candidate decisions', () => {
|
||||
function Screen() {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user