commit melhorias compras3
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-22 10:56:58 +02:00
parent 4fac443dda
commit efd97e265b
130 changed files with 8917 additions and 363 deletions
@@ -0,0 +1,68 @@
import { App } from '@inertiajs/react';
import { renderToStaticMarkup } from 'react-dom/server';
import { expect, test } from 'vitest';
import Search from '@/pages/search/procurement';
test('process search separates result groups escapes text and retains page links', () => {
const html = renderToStaticMarkup(
<App
initialComponent={Search}
initialPage={{
component: 'search/procurement',
url: '/compras/pesquisa?q=QA',
version: null,
clearHistory: false,
encryptHistory: true,
props: {
errors: {},
term: 'QA',
groups: [
{
key: 'requests',
title: 'Requisições',
records: {
total: 16,
current_page: 1,
last_page: 2,
prev_page_url: null,
next_page_url:
'/compras/pesquisa?q=QA&requests_page=2',
data: [
{
id: 7,
title: 'QA <original>',
detail: 'draft',
href: '/requisicoes/7',
},
],
},
},
],
},
}}
/>,
);
expect(html).toContain('QA &lt;original&gt;');
expect(html).toContain('Rascunho');
expect(html).toContain('q=QA&amp;requests_page=2');
expect(html).toContain('/requisicoes/7');
expect(html).toContain('ainda não pesquisa Pessoas, facturas');
});
test('empty search explains the minimum input rather than implying that the database is empty', () => {
const html = renderToStaticMarkup(
<App
initialComponent={Search}
initialPage={{
component: 'search/procurement',
url: '/compras/pesquisa',
version: null,
clearHistory: false,
encryptHistory: true,
props: { errors: {}, term: '', groups: [] },
}}
/>,
);
expect(html).toContain('Introduza pelo menos dois caracteres');
expect(html).not.toContain('Nenhum resultado no seu âmbito');
});