XInvoice Test Suite
This directory contains tests for the XInvoice library.
Running Tests
Use the test runner to run the test suite:
tsx test/run-tests.ts
Test Structure
- 
PDF Export Tests ( test.pdf-export.ts): Test PDF export functionality with embedded XML for different formats.- Verifies the exported PDF structure contains proper embedded files
- Tests type safety of format parameters
- Confirms invoice items are properly included during export
- Checks format-specific XML structures
 
- 
Circular Encoding/Decoding Tests ( test.circular-encoding-decoding.ts): Test the encoding and decoding of invoice data.- Tests full circular process: original → XML → import → export → reimport
- Verifies data preservation through multiple conversions
- Tests special character handling
- Tests variations in invoice content (different items, etc.)
 
Test Data
The test suite uses sample data files from:
- test/assets/getasset.ts: Utility for loading test assets
- test/assets/letter: Sample invoice data
Known Issues
The circular validation tests (test.circular-validation.ts) currently have type compatibility issues and are not included in the automated test run. These will be addressed in a future update.