This commit is contained in:
2025-05-27 21:03:10 +00:00
parent 9e46a55057
commit e4c762658d
9 changed files with 232 additions and 10 deletions

View File

@ -412,4 +412,55 @@ This makes the module fully spec-compliant and suitable as the default open-sour
7. **Fix validation**: Implement missing validation rules (EN16931, XRechnung CIUS)
8. **Add PDF/A-3 compliance**: Implement proper PDF/A-3 compliance checking
9. **Add digital signatures**: Support for digital signatures
10. **Error recovery**: Implement proper error recovery for malformed XML
10. **Error recovery**: Implement proper error recovery for malformed XML
## Test Suite Compatibility Issue (2025-01-27)
### Problem Identified
Many test suites in the project are failing with "t.test is not a function" error. This is because:
- Tests were written for tap.js v16+ which supports subtests via `t.test()`
- Project uses @git.zone/tstest which only supports top-level `tap.test()`
### Affected Test Suites
- All parsing tests (test.parse-01 through test.parse-12)
- All PDF operation tests (test.pdf-01 through test.pdf-12)
- All performance tests (test.perf-01 through test.perf-12)
- All security tests (test.sec-01 through test.sec-10)
- All standards compliance tests (test.std-01 through test.std-10)
- All validation tests (test.val-09 through test.val-14)
### Root Cause
The tests appear to have been written for a different testing framework or a newer version of tap that supports nested tests.
### Solution Options
1. **Refactor all tests**: Convert nested `t.test()` calls to separate `tap.test()` blocks
2. **Upgrade testing framework**: Switch to a newer version of tap that supports subtests
3. **Use a compatibility layer**: Create a wrapper that translates the test syntax
### EN16931 Validation Implementation (2025-01-27)
Successfully implemented EN16931 mandatory field validation to make the library more spec-compliant:
1. **Created EN16931Validator class** in `ts/formats/validation/en16931.validator.ts`
- Validates mandatory fields according to EN16931 business rules
- Validates ISO 4217 currency codes
- Throws descriptive errors for missing/invalid fields
2. **Integrated validation into decoders**:
- XRechnungDecoder
- FacturXDecoder
- ZUGFeRDDecoder
- ZUGFeRDV1Decoder
3. **Added validation to EInvoice.toXmlString()**
- Validates mandatory fields before encoding
- Ensures spec compliance for all exports
4. **Fixed error-handling tests**:
- ERR-02: Validation errors test - Now properly throws on invalid XML
- ERR-05: Memory errors test - Now catches validation errors
- ERR-06: Concurrent errors test - Now catches validation errors
- ERR-10: Configuration errors test - Now validates currency codes
### Results
All error-handling tests are now passing. The library is more spec-compliant by enforcing EN16931 mandatory field requirements.