@@ -0,0 +1,119 @@
|
||||
import { App, router } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { afterEach, expect, test, vi } from 'vitest';
|
||||
import Award from '@/pages/purchases/award';
|
||||
import { money } from '@/types/procurement';
|
||||
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
const option = {
|
||||
allocation_key: 'qa-a',
|
||||
line_id: 12,
|
||||
centre_id: 4,
|
||||
subtotal: '50.00',
|
||||
total: '50.00',
|
||||
line_label: 'Artigo sintético',
|
||||
centre_label: 'Centro sintético',
|
||||
};
|
||||
function render(
|
||||
currency = 'MZN',
|
||||
reference: object | null = null,
|
||||
actorId = 7,
|
||||
) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={Award}
|
||||
initialPage={{
|
||||
component: 'purchases/award',
|
||||
url: '/requisicoes/2/adjudicacao',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
auth: { user: { id: actorId, tenant_id: 3 } },
|
||||
requisition: { id: 2, number: 'QA-2', process_version: 4 },
|
||||
award: null,
|
||||
canSelect: true,
|
||||
canDecide: false,
|
||||
canIssue: false,
|
||||
order: null,
|
||||
recommendation: { adopted: false, quotation_id: null },
|
||||
budgetDistributionOptions: [option],
|
||||
comparison: {
|
||||
ready: true,
|
||||
top_ids: [1],
|
||||
policy: {
|
||||
revision: 0,
|
||||
configured: false,
|
||||
minimum_proposals: 3,
|
||||
minimum_evaluators: 2,
|
||||
weights: {
|
||||
price: 40,
|
||||
quality: 20,
|
||||
delivery: 15,
|
||||
history: 15,
|
||||
payment: 10,
|
||||
},
|
||||
},
|
||||
rows: [
|
||||
{
|
||||
id: 1,
|
||||
reference: 'QA-QUOTE',
|
||||
supplier: { name: 'Fornecedor sintético' },
|
||||
total_minor: 10000,
|
||||
subtotal_minor: 10000,
|
||||
tax_minor: 0,
|
||||
currency,
|
||||
reference_amounts: reference,
|
||||
evaluation_count: 2,
|
||||
eligible: true,
|
||||
ineligibility_reasons: [],
|
||||
score: 8,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
function rememberSelection() {
|
||||
vi.spyOn(router, 'restore').mockImplementation((key) =>
|
||||
key === 'award-selection:3:7:2:4:data'
|
||||
? {
|
||||
quotation_id: '1',
|
||||
justification: '',
|
||||
delivery_date: '',
|
||||
delivery_location: '',
|
||||
reason: '',
|
||||
budget_distribution_preparation: [option],
|
||||
}
|
||||
: undefined,
|
||||
);
|
||||
}
|
||||
test('quote is chosen before explicit allocations and a different actor cannot inherit the selection', () => {
|
||||
expect(render()).not.toContain('<legend>Distribuição explícita');
|
||||
rememberSelection();
|
||||
const html = render();
|
||||
expect(html.indexOf('id="award-quote"')).toBeLessThan(
|
||||
html.indexOf('<legend>Distribuição explícita'),
|
||||
);
|
||||
expect(html).toContain('Referência da proposta em MZN');
|
||||
expect(render('MZN', null, 8)).not.toContain(
|
||||
'<legend>Distribuição explícita',
|
||||
);
|
||||
});
|
||||
test('foreign values never replace an unavailable MZN reference and a frozen reference is shown exactly', () => {
|
||||
rememberSelection();
|
||||
const missing = render('USD');
|
||||
expect(missing).toContain('Referência em MZN indisponível');
|
||||
expect(missing).toMatch(/disabled=""[^>]*>Registar adjudicação/);
|
||||
const converted = render('USD', {
|
||||
subtotal_minor: 600000,
|
||||
tax_minor: 0,
|
||||
total_minor: 600000,
|
||||
});
|
||||
expect(converted).toContain(money(600000, 'MZN'));
|
||||
expect(converted).not.toContain(`sem IVA ${money(10000, 'MZN')}`);
|
||||
expect(converted).not.toContain('Referência em MZN indisponível');
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import BudgetDistributionFields from '@/components/budget-distribution-fields';
|
||||
|
||||
test('explicit MZN input preserves decimal strings and identifies each article and centre accessibly', () => {
|
||||
const row = {
|
||||
allocation_key: 'qa-a',
|
||||
line_id: 12,
|
||||
centre_id: 4,
|
||||
subtotal: '999999999999.99',
|
||||
total: '999999999999.99',
|
||||
};
|
||||
const html = renderToStaticMarkup(
|
||||
<BudgetDistributionFields
|
||||
options={[
|
||||
{
|
||||
...row,
|
||||
line_label: 'Artigo sintético',
|
||||
centre_label: 'Produção sintética',
|
||||
},
|
||||
]}
|
||||
rows={[row]}
|
||||
onChange={() => {}}
|
||||
reason=""
|
||||
onReason={() => {}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('Artigo sintético');
|
||||
expect(html).toContain('Produção sintética');
|
||||
expect(html.match(/value="999999999999.99"/g)).toHaveLength(2);
|
||||
expect(html).toContain('Sem IVA (MZN)');
|
||||
expect(html).toContain('Total (MZN)');
|
||||
expect(html).toContain('minLength="10"');
|
||||
expect(html).toContain(
|
||||
'Nenhuma diferença será distribuída automaticamente',
|
||||
);
|
||||
});
|
||||
|
||||
test('unknown partial allocations stay blank until explicitly entered', () => {
|
||||
const row = {
|
||||
allocation_key: 'qa-b',
|
||||
line_id: 13,
|
||||
centre_id: 5,
|
||||
subtotal: '',
|
||||
total: '',
|
||||
};
|
||||
const html = renderToStaticMarkup(
|
||||
<BudgetDistributionFields
|
||||
options={[
|
||||
{
|
||||
...row,
|
||||
line_label: 'Outro artigo',
|
||||
centre_label: 'Outro centro',
|
||||
},
|
||||
]}
|
||||
rows={[row]}
|
||||
onChange={() => {}}
|
||||
reason=""
|
||||
onReason={() => {}}
|
||||
/>,
|
||||
);
|
||||
expect(html.match(/value=""/g)).toHaveLength(2);
|
||||
expect(html).not.toContain('value="0"');
|
||||
expect(html).toContain('inputMode="decimal"');
|
||||
});
|
||||
@@ -0,0 +1,101 @@
|
||||
import { App, router } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { afterEach, expect, test, vi } from 'vitest';
|
||||
import Invoices from '@/pages/invoices/index';
|
||||
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
function render(actorId = 7) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={Invoices}
|
||||
initialPage={{
|
||||
component: 'invoices/index',
|
||||
url: '/facturas?purchase_order_id=2',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
auth: { user: { id: actorId, tenant_id: 3 } },
|
||||
focusOrderId: 2,
|
||||
canManage: true,
|
||||
invoices: {
|
||||
data: [],
|
||||
current_page: 1,
|
||||
last_page: 1,
|
||||
prev_page_url: null,
|
||||
next_page_url: null,
|
||||
total: 0,
|
||||
},
|
||||
orders: [
|
||||
{
|
||||
id: 2,
|
||||
number: 'QA-OC',
|
||||
currency: 'USD',
|
||||
supplier: 'Fornecedor sintético',
|
||||
items: [
|
||||
{
|
||||
id: 5,
|
||||
requisition_item_id: 12,
|
||||
description: 'Material sintético',
|
||||
unit: 'cx',
|
||||
unit_price_minor: 10000,
|
||||
tax_rate: '0',
|
||||
},
|
||||
],
|
||||
budgetDistributionOptions: [
|
||||
{
|
||||
allocation_key: 'qa-a',
|
||||
line_id: 12,
|
||||
centre_id: 4,
|
||||
subtotal: '50.00',
|
||||
total: '50.00',
|
||||
line_label: 'Material sintético',
|
||||
centre_label: 'Centro sintético',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
test('returning from explicit commitment amendment restores invoice fields and MZN parcels within the same actor context', () => {
|
||||
vi.spyOn(router, 'restore').mockImplementation((key) =>
|
||||
key === 'invoice-preparation:3:7:2:data'
|
||||
? {
|
||||
number: 'QA-UNSAVED',
|
||||
issued_on: '2026-11-22',
|
||||
subtotal: '60.00',
|
||||
tax: '0.00',
|
||||
total: '60.00',
|
||||
reason: 'Imputação sintética ainda em preparação.',
|
||||
items: [
|
||||
{
|
||||
purchase_order_item_id: 5,
|
||||
quantity: '0.600',
|
||||
unit: 'cx',
|
||||
unit_price: '100.00',
|
||||
tax_rate: '0',
|
||||
},
|
||||
],
|
||||
budget_distribution_preparation: [
|
||||
{
|
||||
allocation_key: 'qa-a',
|
||||
line_id: 12,
|
||||
centre_id: 4,
|
||||
subtotal: '30.00',
|
||||
total: '30.00',
|
||||
},
|
||||
],
|
||||
}
|
||||
: undefined,
|
||||
);
|
||||
const html = render();
|
||||
expect(html).toContain('value="QA-UNSAVED"');
|
||||
expect(html).toContain('value="0.600"');
|
||||
expect(html).toContain('value="30.00"');
|
||||
expect(html).toContain('/ordens/2/reafectacao');
|
||||
expect(render(8)).not.toContain('value="QA-UNSAVED"');
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import {
|
||||
ProcurementPayableInsights,
|
||||
exactMinorAmount,
|
||||
} from '@/components/procurement-payable-insights';
|
||||
|
||||
test('financial display preserves cent values beyond floating point precision', () => {
|
||||
expect(exactMinorAmount('9007199254740993', 'MZN')).toBe(
|
||||
'90.071.992.547.409,93 MZN',
|
||||
);
|
||||
expect(exactMinorAmount('1', 'USD')).toBe('0,01 USD');
|
||||
expect(exactMinorAmount('-100', 'MZN')).toBe('-1,00 MZN');
|
||||
expect(exactMinorAmount('unknown', 'MZN')).toBe('Indeterminado');
|
||||
});
|
||||
|
||||
test('report explains its native coverage current balance and separate currencies without treating unknowns as zero', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<ProcurementPayableInsights
|
||||
exportHref="/relatorios/obrigacoes.csv?status=approved&search=QA"
|
||||
data={{
|
||||
method: 'native_payable_positions_v1',
|
||||
coverage: {
|
||||
invoices: 4,
|
||||
recognised: 2,
|
||||
unrecognised: 1,
|
||||
indeterminate: 1,
|
||||
},
|
||||
currencies: ['MZN', 'USD'].map((currency) => ({
|
||||
currency,
|
||||
count: 1,
|
||||
principal_minor: '10000',
|
||||
balance_minor: '6000',
|
||||
confirmed_payments_minor: '1000',
|
||||
allocated_payments_minor: '3000',
|
||||
})),
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('100,00 MZN');
|
||||
expect(html).toContain('60,00 USD');
|
||||
expect(html).toContain('não é tratada como saldo zero');
|
||||
expect(html).toContain('sem conversão adicional');
|
||||
expect(html).toContain('criação do pedido');
|
||||
expect(html).toContain('/obrigacoes-fornecedores');
|
||||
expect(html).toContain(
|
||||
'/relatorios/obrigacoes.csv?status=approved&search=QA',
|
||||
);
|
||||
expect(html).toContain('Exportar posição actual (CSV)');
|
||||
});
|
||||
@@ -46,7 +46,54 @@ test('process search separates result groups escapes text and retains page links
|
||||
expect(html).toContain('Rascunho');
|
||||
expect(html).toContain('q=QA&requests_page=2');
|
||||
expect(html).toContain('/requisicoes/7');
|
||||
expect(html).toContain('ainda não pesquisa Pessoas, facturas');
|
||||
expect(html).toContain('A pesquisa não inclui Pessoas');
|
||||
expect(html).not.toContain('acesso financeiro');
|
||||
});
|
||||
|
||||
test('financial search explains references and states only when available', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={Search}
|
||||
initialPage={{
|
||||
component: 'search/procurement',
|
||||
url: '/compras/pesquisa?q=FT',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
term: 'FT',
|
||||
invoiceSearchAvailable: true,
|
||||
groups: [
|
||||
{
|
||||
key: 'invoices',
|
||||
title: 'Facturas de fornecedor',
|
||||
records: {
|
||||
total: 1,
|
||||
current_page: 1,
|
||||
last_page: 1,
|
||||
prev_page_url: null,
|
||||
next_page_url: null,
|
||||
data: [
|
||||
{
|
||||
id: 9,
|
||||
title: 'FT <QA>',
|
||||
detail: 'confirmed',
|
||||
href: '/facturas?invoice_id=9',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('pelo número, dentro do seu acesso financeiro');
|
||||
expect(html).toContain('mostram a referência e o estado');
|
||||
expect(html).toContain('FT <QA>');
|
||||
expect(html).toContain('Confirmada');
|
||||
expect(html).toContain('/facturas?invoice_id=9');
|
||||
});
|
||||
|
||||
test('empty search explains the minimum input rather than implying that the database is empty', () => {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import { App } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import Orders from '@/pages/purchases/index';
|
||||
import Show from '@/pages/purchases/show';
|
||||
|
||||
const order = {
|
||||
id: 1,
|
||||
number: 'OC-QA',
|
||||
requisition_id: 2,
|
||||
issued_at: '2026-11-22T08:00:00Z',
|
||||
currency: 'MZN',
|
||||
total_minor: 10000,
|
||||
snapshot: {
|
||||
supplier: { name: 'Fornecedor <QA>' },
|
||||
company: { name: 'Empresa QA' },
|
||||
},
|
||||
items: [
|
||||
{
|
||||
id: 1,
|
||||
description: 'Artigo preservado',
|
||||
quantity: '1.000',
|
||||
unit: 'cx',
|
||||
total_minor: 10000,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
function render(
|
||||
component: typeof Orders | typeof Show,
|
||||
props: Record<string, unknown>,
|
||||
) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={component}
|
||||
initialPage={{
|
||||
component: 'purchases/index',
|
||||
url: '/ordens',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: { errors: {}, ...props },
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
test('an older incomplete order cannot blank the order list', () => {
|
||||
const html = render(Orders, {
|
||||
orders: { data: [order], prev_page_url: null, next_page_url: null },
|
||||
awards: { data: [], prev_page_url: null, next_page_url: null },
|
||||
});
|
||||
expect(html).toContain('OC-QA');
|
||||
expect(html).toContain('Fornecedor <QA>');
|
||||
expect(html).toContain('Referência não preservada no original');
|
||||
expect(html).toContain('/ordens/1');
|
||||
});
|
||||
|
||||
test('incomplete detail identifies the missing original and preserves documented values and items', () => {
|
||||
const html = render(Show, { order, history: [], snapshotComplete: false });
|
||||
expect(html).toContain('Documento original incompleto');
|
||||
expect(html).toContain('Artigo preservado');
|
||||
expect(html).toContain('100,00');
|
||||
expect(html).toContain('/ordens/1/imprimir');
|
||||
expect(html).not.toContain('Aprovações do valor final');
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import { App } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import { RequisitionApprovalSettings } from '@/components/requisition-approval-settings';
|
||||
import { procurementNavigation } from '@/lib/procurement-navigation';
|
||||
|
||||
function render(ready: boolean) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={RequisitionApprovalSettings}
|
||||
initialPage={{
|
||||
component: 'company/parameters',
|
||||
url: '/administracao/parametrizacao',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
ready,
|
||||
version: 4,
|
||||
profiles: [
|
||||
{
|
||||
id: 7,
|
||||
name: 'Direcção QA',
|
||||
permissions: ['requisition_approve'],
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: 'Consulta revogada QA',
|
||||
permissions: ['requester'],
|
||||
},
|
||||
],
|
||||
costCenters: [{ id: 1, code: 'QA', name: 'Centro QA' }],
|
||||
plan: {
|
||||
revision: 2,
|
||||
enabled: true,
|
||||
quorum: 'one_eligible',
|
||||
levels: [
|
||||
{
|
||||
name: 'Conferência <QA>',
|
||||
profile_ids: [7, 8],
|
||||
scope: 'company',
|
||||
min_minor: 11601,
|
||||
categories: ['Material'],
|
||||
cost_center_ids: [1],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
test('approval settings retain exact threshold and selected revoked profiles so the administrator can reconcile the plan', () => {
|
||||
const html = render(true);
|
||||
expect(html).toContain('116.01');
|
||||
expect(html).toContain('Conferência <QA>');
|
||||
expect(html).toContain('Direcção QA');
|
||||
expect(html).toContain('Consulta revogada QA');
|
||||
expect(html).toContain('Sem competência de aprovação actualmente');
|
||||
expect(html).toContain('basta um aprovador');
|
||||
expect(html).toContain('apenas a novas submissões');
|
||||
});
|
||||
|
||||
test('unavailable capability explains the existing circuit without offering a nonfunctional plan form', () => {
|
||||
const html = render(false);
|
||||
expect(html).toContain('O circuito actual permanece em vigor');
|
||||
expect(html).not.toContain('<form');
|
||||
});
|
||||
|
||||
test('a configured approver gets approval navigation without supplier or finance access links', () => {
|
||||
const entries = procurementNavigation(
|
||||
['requisition_approve'],
|
||||
false,
|
||||
).flatMap((group) => group.entries);
|
||||
expect(
|
||||
entries.some((entry) => entry.path === '/requisicoes?view=approvals'),
|
||||
).toBe(true);
|
||||
expect(entries.some((entry) => entry.path === '/facturas')).toBe(false);
|
||||
expect(entries.some((entry) => entry.path === '/fornecedores')).toBe(false);
|
||||
});
|
||||
@@ -0,0 +1,124 @@
|
||||
import { App, router } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { afterEach, expect, test, vi } from 'vitest';
|
||||
import RequisitionForm from '@/pages/requisitions/form';
|
||||
import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
test('restored technical identities do not mark a cleared preparation as changed', () => {
|
||||
const original = {
|
||||
operation_key: 'initial-operation',
|
||||
justification: '',
|
||||
items: [
|
||||
{
|
||||
key: 'initial-row',
|
||||
description: '',
|
||||
quantity: '1.000',
|
||||
unit_price: '',
|
||||
},
|
||||
],
|
||||
};
|
||||
const recovered = {
|
||||
items: [
|
||||
{
|
||||
unit_price: '',
|
||||
quantity: '1.000',
|
||||
description: '',
|
||||
key: 'recovered-row',
|
||||
},
|
||||
],
|
||||
justification: '',
|
||||
operation_key: 'recovered-operation',
|
||||
};
|
||||
expect(hasPreparationChanges(original, recovered)).toBe(false);
|
||||
expect(
|
||||
hasPreparationChanges(original, {
|
||||
...recovered,
|
||||
justification: 'Still unsaved',
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
hasPreparationChanges(original, {
|
||||
...recovered,
|
||||
items: [{ ...recovered.items[0], quantity: '2.000' }],
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
hasPreparationChanges(original, {
|
||||
...recovered,
|
||||
items: [...recovered.items, recovered.items[0]],
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
const restored = {
|
||||
operation_key: 'kept-operation',
|
||||
process_version: null,
|
||||
cost_center_id: '',
|
||||
priority: 'normal',
|
||||
needed_by: '',
|
||||
justification: 'Preparação ao regressar',
|
||||
items: [
|
||||
{
|
||||
key: 'kept-line',
|
||||
source_line_id: '',
|
||||
catalogue_entry_id: '',
|
||||
catalogue_version: '',
|
||||
catalogue_code: '',
|
||||
description: 'Artigo ainda por gravar',
|
||||
category: 'Material',
|
||||
purchase_type: 'consumable',
|
||||
quantity: '2.000',
|
||||
unit: 'UN',
|
||||
unit_price: '',
|
||||
tax_rate: '16.00',
|
||||
equipment_id: '',
|
||||
spare_part_id: '',
|
||||
production_area: '',
|
||||
downtime_started_at: '',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
function render(userId = 7, tenantId = 3) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={RequisitionForm}
|
||||
initialPage={{
|
||||
component: 'requisitions/form',
|
||||
url: '/requisicoes/criar',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
auth: { user: { id: userId, tenant_id: tenantId } },
|
||||
internalRequisitionReady: true,
|
||||
incompleteDraftsAvailable: true,
|
||||
costCenters: [],
|
||||
requisition: null,
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
test('native remembered history restores unfinished fields and line values without saving a process', () => {
|
||||
vi.spyOn(router, 'restore').mockImplementation((key) =>
|
||||
key === 'requisition:3:7:new:0:data' ? restored : undefined,
|
||||
);
|
||||
const html = render();
|
||||
expect(html).toContain('Preparação ao regressar');
|
||||
expect(html).toContain('Artigo ainda por gravar');
|
||||
expect(html).toContain('value="2.000"');
|
||||
expect(html).not.toContain('value="0.00"');
|
||||
});
|
||||
|
||||
test('remembered preparation is separated by user and company', () => {
|
||||
vi.spyOn(router, 'restore').mockImplementation((key) =>
|
||||
key === 'requisition:3:7:new:0:data' ? restored : undefined,
|
||||
);
|
||||
expect(render(8, 3)).not.toContain('Artigo ainda por gravar');
|
||||
expect(render(7, 4)).not.toContain('Artigo ainda por gravar');
|
||||
});
|
||||
Reference in New Issue
Block a user