1.4 KiB
1.4 KiB
How to Fix Tests in the einvoice Library
Important: You CAN Modify the Library Code!
When tests fail, the goal is to fix the root causes in the einvoice library itself, not just adjust test expectations.
Key Points:
- Tests reveal bugs - If a test shows that UTF-8 characters aren't preserved, that's a bug in the library
- Fix the library - Modify the code in
ts/
to make the tests pass - Maintain spec compliance - The goal is to be as spec-compliant as possible
- Don't lower expectations - Don't make tests pass by accepting broken behavior
Common Issues to Fix:
-
UTF-8 Character Preservation
- Special characters should be preserved in all fields
- Invoice IDs with special characters should work
- Subject and notes fields should maintain their content
-
Round-trip Conversion
- Data exported to XML and imported back should remain the same
- All fields should be preserved during import/export
-
Character Encoding
- XML should properly handle all UTF-8 characters
- Special XML characters (&, <, >, ", ') should be properly escaped
- Unicode characters should be preserved, not converted to entities
Process:
- Run the failing test
- Identify what the library is doing wrong
- Fix the library code in
ts/
- Verify the test now passes
- Ensure no other tests break
Remember: The tests are there to improve the einvoice library!