commit compras1 2911
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-29 05:28:30 +02:00
parent 1ddabbbdcc
commit 448948a487
137 changed files with 9481 additions and 1926 deletions
@@ -4,7 +4,21 @@ import { afterEach, expect, test, vi } from 'vitest';
import Invoices from '@/pages/invoices/index';
afterEach(() => vi.restoreAllMocks());
function render(actorId = 7) {
test.each([true, false])(
'invoice consultation has a focusable document destination and separates registration (%s)',
(canManage) => {
const html = render(7, canManage);
expect(html).toContain('href="#invoice-documents"');
expect(html).toContain('id="invoice-documents" tabindex="-1"');
expect(html).toContain('lg:scroll-mt-72');
expect(html.includes('href="#invoice-registration"')).toBe(canManage);
expect(html.includes('id="invoice-registration"')).toBe(canManage);
expect(html).toContain('Sem facturas disponíveis para esta ordem.');
expect(html).not.toContain('Sem facturas registadas nesta empresa.');
},
);
function render(actorId = 7, canManage = true) {
return renderToStaticMarkup(
<App
initialComponent={Invoices}
@@ -18,7 +32,7 @@ function render(actorId = 7) {
errors: {},
auth: { user: { id: actorId, tenant_id: 3 } },
focusOrderId: 2,
canManage: true,
canManage,
invoices: {
data: [],
current_page: 1,