commit melhorias compras5
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-22 19:39:09 +02:00
parent 36dcfdf00c
commit db1615fac1
79 changed files with 4082 additions and 120 deletions
@@ -6,6 +6,38 @@ import { hasPreparationChanges } from '@/lib/requisition-history';
afterEach(() => vi.restoreAllMocks());
test('new empty classification fields preserve an older recovered preparation while real classification changes remain dirty', () => {
const old = { items: [{ description: 'Artigo anterior' }] };
const current = {
items: [
{
description: 'Artigo anterior',
procurement_category: '',
category_reason: '',
},
],
};
expect(hasPreparationChanges(old, current)).toBe(false);
expect(hasPreparationChanges(current, old)).toBe(false);
expect(
hasPreparationChanges(old, {
items: [
{
...current.items[0],
procurement_category: 'office_equipment',
},
],
}),
).toBe(true);
expect(
hasPreparationChanges(old, {
items: [
{ ...current.items[0], category_reason: 'Razão deliberada' },
],
}),
).toBe(true);
});
test('restored technical identities do not mark a cleared preparation as changed', () => {
const original = {
operation_key: 'initial-operation',