34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { XInvoice } from '../ts/classes.xinvoice.js';
|
|
import { ValidationLevel } from '../ts/interfaces/common.js';
|
|
import * as assert from 'assert';
|
|
|
|
/**
|
|
* Test for XInvoice class
|
|
*/
|
|
async function testXInvoice() {
|
|
console.log('Starting XInvoice tests...');
|
|
|
|
try {
|
|
// Test creating a new XInvoice instance
|
|
const xinvoice = new XInvoice();
|
|
|
|
// Check that the XInvoice instance has the expected properties
|
|
assert.strictEqual(xinvoice.type, 'invoice', 'XInvoice type should be "invoice"');
|
|
assert.strictEqual(xinvoice.invoiceType, 'debitnote', 'XInvoice invoiceType should be "debitnote"');
|
|
assert.strictEqual(xinvoice.status, 'invoice', 'XInvoice status should be "invoice"');
|
|
|
|
// Check that the XInvoice instance has the expected methods
|
|
assert.strictEqual(typeof xinvoice.exportXml, 'function', 'XInvoice should have an exportXml method');
|
|
assert.strictEqual(typeof xinvoice.exportPdf, 'function', 'XInvoice should have an exportPdf method');
|
|
assert.strictEqual(typeof xinvoice.validate, 'function', 'XInvoice should have a validate method');
|
|
|
|
console.log('All XInvoice tests passed!');
|
|
} catch (error) {
|
|
console.error('XInvoice test failed:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the test
|
|
testXInvoice();
|