feat(encoder): Rename encoder class from ZugferdXmlEncoder to FacturXEncoder to better reflect Factur-X compliance. All related imports, exports, and tests have been updated while maintaining backward compatibility.

This commit is contained in:
2025-03-17 15:18:33 +00:00
parent f07f81c585
commit cdf4179613
10 changed files with 687 additions and 36 deletions

View File

@ -2,7 +2,7 @@ import { tap, expect } from '@push.rocks/tapbundle';
import * as fs from 'fs/promises';
import * as xinvoice from '../ts/index.js';
import * as getInvoices from './assets/getasset.js';
import { ZugferdXmlEncoder } from '../ts/classes.encoder.js';
import { FacturXEncoder } from '../ts/classes.encoder.js';
import { ZUGFeRDXmlDecoder } from '../ts/classes.decoder.js';
// Group 1: Basic functionality tests for XInvoice class
@ -91,11 +91,12 @@ tap.test('XInvoice should correctly handle XML and LetterData', async () => {
});
// Group 5: Basic encoder test
tap.test('ZugferdXmlEncoder instance should be created', async () => {
const encoder = new ZugferdXmlEncoder();
tap.test('FacturXEncoder instance should be created', async () => {
const encoder = new FacturXEncoder();
expect(encoder).toBeTypeOf('object');
// Testing the existence of the method without calling it
expect(encoder.createZugferdXml).toBeTypeOf('function');
// Testing the existence of methods without calling them
expect(encoder.createFacturXXml).toBeTypeOf('function');
expect(encoder.createZugferdXml).toBeTypeOf('function'); // For backward compatibility
});
// Group 6: Basic decoder test