This commit is contained in:
2025-03-17 16:30:23 +00:00
parent bbc9b837f4
commit e929281861
20 changed files with 1777 additions and 381 deletions

View File

@ -1,7 +1,7 @@
import { tap, expect } from '@push.rocks/tapbundle';
import * as getInvoices from './assets/getasset.js';
import { FacturXEncoder } from '../ts/classes.encoder.js';
import { ZUGFeRDXmlDecoder } from '../ts/classes.decoder.js';
import { FacturXEncoder } from '../ts/formats/facturx.encoder.js';
import { FacturXDecoder } from '../ts/formats/facturx.decoder.js';
import { XInvoice } from '../ts/classes.xinvoice.js';
import * as tsclass from '@tsclass/tsclass';
@ -64,7 +64,7 @@ tap.test('Basic circular encode/decode test', async () => {
expect(xml).toInclude(testLetterData.content.invoiceData.id);
// Now create a decoder to parse the XML back
const decoder = new ZUGFeRDXmlDecoder(xml);
const decoder = new FacturXDecoder(xml);
const decodedLetter = await decoder.getLetterData();
// Verify we got a letter back
@ -98,7 +98,7 @@ tap.test('Circular encode/decode with different invoice types', async () => {
expect(xml).toInclude(creditNoteLetter.content.invoiceData.id);
// Now create a decoder to parse the XML back
const decoder = new ZUGFeRDXmlDecoder(xml);
const decoder = new FacturXDecoder(xml);
const decodedLetter = await decoder.getLetterData();
// Verify we got data back
@ -158,7 +158,7 @@ tap.test('Circular test with varying item counts', async () => {
expect(lineCount).toBeGreaterThan(20); // Minimum lines for header etc.
// Now create a decoder to parse the XML back
const decoder = new ZUGFeRDXmlDecoder(xml);
const decoder = new FacturXDecoder(xml);
const decodedLetter = await decoder.getLetterData();
// Verify the item count isn't multiplied in the round trip
@ -198,7 +198,7 @@ tap.test('Circular test with special characters', async () => {
expect(xml).not.toInclude('<&>');
// Now create a decoder to parse the XML back
const decoder = new ZUGFeRDXmlDecoder(xml);
const decoder = new FacturXDecoder(xml);
const decodedLetter = await decoder.getLetterData();
// Verify the basic structure was recovered