# 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: 1. **Tests reveal bugs** - If a test shows that UTF-8 characters aren't preserved, that's a bug in the library 2. **Fix the library** - Modify the code in `ts/` to make the tests pass 3. **Maintain spec compliance** - The goal is to be as spec-compliant as possible 4. **Don't lower expectations** - Don't make tests pass by accepting broken behavior ### Common Issues to Fix: 1. **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 2. **Round-trip Conversion** - Data exported to XML and imported back should remain the same - All fields should be preserved during import/export 3. **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: 1. Run the failing test 2. Identify what the library is doing wrong 3. Fix the library code in `ts/` 4. Verify the test now passes 5. Ensure no other tests break Remember: The tests are there to improve the einvoice library!