Skip to content

test(js): add smoke tests for web bindings#1544

Open
caarloshenriq wants to merge 1 commit intopayjoin:masterfrom
caarloshenriq:test/js-web-bindings
Open

test(js): add smoke tests for web bindings#1544
caarloshenriq wants to merge 1 commit intopayjoin:masterfrom
caarloshenriq:test/js-web-bindings

Conversation

@caarloshenriq
Copy link
Copy Markdown
Contributor

@caarloshenriq caarloshenriq commented May 8, 2026

Closes #1526

This PR adds smoke tests for the JavaScript web bindings (ESModule/WASM target), which were missing after the web bindings were introduced in #1513.

What was done

  • Added test/unit.web.test.ts with smoke tests for the web bindings, covering:
    • URI parsing
    • Receiver/sender persistence (sync and async)
    • Receiver cancellation (sync and async)
    • Input validation
  • Updated package.json to include the new test file in the test script

Approach

The web bindings use WASM and are designed for browser/bundler environments (Vite). To test them in Node.js without introducing new dependencies, the tests load the .wasm binary directly via readFileSync and pass it to the initAsync function, bypassing the Vite-specific asset import. This allows the existing node:test + tsx infrastructure to be reused.

Notes

I used Claude Sonnet 4.6 to help me understand the codebase.

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 25571281257

Coverage remained the same at 85.169%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 13519
Covered Lines: 11514
Line Coverage: 85.17%
Coverage Strength: 400.02 hits per line

💛 - Coveralls

@spacebear21 spacebear21 requested a review from xstoicunicornx May 8, 2026 21:24
Copy link
Copy Markdown
Collaborator

@xstoicunicornx xstoicunicornx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Since it is possible to load the web wasm in this way could we instead load the web wasm in the existing test files and run the tests for each side by side? Maybe worth using Jest so we can run tests for each payjoin instance without duplicating code? This will make it a lot easier to keep our tests in sync. For example the sender async persistence test seems to be missing from your unit test.

Additionally we probably want integration tests to be in scope as well.

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.

Javascript Web Bindings Need Tests

3 participants