Skip to content

refactor(tests): Improve test readability by converting batch summaries to individual test cases#227

Merged
matthewjablack merged 1 commit into
masterfrom
refactor/improve-compatibility-test-readability
Jul 19, 2025
Merged

refactor(tests): Improve test readability by converting batch summaries to individual test cases#227
matthewjablack merged 1 commit into
masterfrom
refactor/improve-compatibility-test-readability

Conversation

@matthewjablack
Copy link
Copy Markdown
Contributor

Problem

The compatibility tests were using batch summaries that made debugging difficult:

  • Aggregate results like "DlcOffer: 14 pass, 0 fail"
  • No way to identify which specific test vector failed
  • Console logging instead of proper test assertions
  • Emoji clutter in test output

Solution

Convert all batch test summaries to individual test cases:

Before:

DlcOffer Serialization Test Results:
Passed: 14/14
Failed: 0/14
✓ should test DlcOffer serialization against all test vectors

After:

✓ should correctly serialize DlcOffer for enum_3_of_3_test.json
✓ should correctly serialize DlcOffer for enum_3_of_5_test.json
✓ should correctly serialize DlcOffer for enum_and_numerical_3_of_5_test.json

Benefits

  • Precise debugging: Know exactly which test vector fails
  • Targeted testing: npm test -- --grep "enum_3_of_3_test.json"
  • Better CI/CD: Individual pass/fail reporting in test runners
  • Clean output: Removed emojis, proper expect() assertions
  • Code reduction: 408→137 lines (-271 lines, -66% complexity)

Test Coverage

Now provides 127 individual test cases instead of aggregate summaries:

  • 42 serialization tests (14 each for Offer/Accept/Sign)
  • 42 deserialization tests (14 each for Offer/Accept/Sign)
  • 42 cross-language compatibility tests (14 each for Offer/Accept/Sign)
  • 6 Rust-CLI compatibility tests (representative samples)

🔍 Testing

# Run all compatibility tests
npm test compatibility

# Test specific test vector
npm test -- --grep "enum_3_of_3_test.json"

# Test specific message type
npm test -- --grep "should correctly serialize DlcOffer"

Each test failure now provides clear context about which test vector and operation failed, dramatically improving debugging experience.

- replace aggregate pass/fail summaries with granular test cases
- generate individual tests per test vector for better debugging
- remove emoji output and use proper expect() assertions
- reduce code complexity: 408→137 lines (-271 lines)
- enable targeted testing with --grep on specific test vectors
@matthewjablack matthewjablack merged commit 1b25a5c into master Jul 19, 2025
2 checks passed
@matthewjablack matthewjablack deleted the refactor/improve-compatibility-test-readability branch July 19, 2025 02:03
@matthewjablack matthewjablack restored the refactor/improve-compatibility-test-readability branch July 19, 2025 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant