UPO 4.3, fixes for invoices

This commit is contained in:
Michał Chudy
2026-01-16 08:35:43 +01:00
parent 1912b5b48d
commit 5fb5a624b8
64 changed files with 1044 additions and 1444 deletions

View File

@@ -13,6 +13,7 @@ vi.mock('../../../shared/PDF-functions', () => ({
getContentTable: vi.fn(),
getTable: vi.fn(),
getValue: vi.fn(),
getTStawkaPodatku: vi.fn()
}));
describe(generateWiersze.name, () => {
@@ -27,6 +28,7 @@ describe(generateWiersze.name, () => {
P_7: { _text: 'Product 1' },
P_9A: { _text: '100' },
P_8B: { _text: '2' },
P_12: { _text: '23' },
},
],
KodWaluty: { _text: 'PLN' },
@@ -106,7 +108,7 @@ describe(generateWiersze.name, () => {
});
it('should display "brutto" when P_11 is not in fieldsWithValue', () => {
vi.mocked(PDFFunctions.getTable).mockReturnValue([{ NrWierszaFa: { _text: '1' } }] as any);
vi.mocked(PDFFunctions.getTable).mockReturnValue([{ NrWierszaFa: { _text: '1' }, P_12: {_text: '23'} }] as any);
vi.mocked(PDFFunctions.getContentTable).mockReturnValue({
content: { table: {} } as any,
@@ -148,7 +150,7 @@ describe(generateWiersze.name, () => {
});
it('should generate two tables when fieldsWithValue.length > 8', () => {
vi.mocked(PDFFunctions.getTable).mockReturnValue([{ NrWierszaFa: { _text: '1' } }] as any);
vi.mocked(PDFFunctions.getTable).mockReturnValue([{ NrWierszaFa: { _text: '1' }, P_12: {_text: '23'} }] as any);
vi.mocked(PDFFunctions.getContentTable)
.mockReturnValueOnce({
@@ -175,7 +177,7 @@ describe(generateWiersze.name, () => {
});
it('should not add second table if it has only 1 field with value', () => {
vi.mocked(PDFFunctions.getTable).mockReturnValue([{ NrWierszaFa: { _text: '1' } }] as any);
vi.mocked(PDFFunctions.getTable).mockReturnValue([{ NrWierszaFa: { _text: '1' }, P_12: {_text: '23'} }] as any);
vi.mocked(PDFFunctions.getContentTable)
.mockReturnValueOnce({