cardano-wasm demo: test suites wired into CI - #1318
Open
palas wants to merge 1 commit into
Open
Conversation
- tests/CoreTest.elm: 95 elm-test cases for the pure core (bech32 golden vectors from real pools plus negative vectors isolating each guard, ada<->lovelace round-trips, balance boundaries, certificate JSON, list helpers) - tests/wasm/api-regression.mjs: 8 Node tests driving the freshly built lib-wrapper (wallet round-trip, getTxId stability, certificate round-trips asserting the cert, fee and witnesses end up in the signed CBOR, inspectAddress, newConwayTx broken-export probe) - haskell-wasm.yml runs elm-test with the demo build (elm-format now also validates tests/) and the regression suite right after it
palas
requested review from
a team,
CarlosLopezDeLara,
Jimbo4350,
carbolymer,
disassembler and
erikd
as code owners
August 24, 2026 14:47
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Elm and Node.js regression tests for the cardano-wasm demo and wires them into WASM CI.
Changes:
- Adds 95 Elm core tests and Node.js wasm API tests.
- Updates test dependencies, documentation, and demo configuration.
- Runs formatting and both test suites in CI.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Reviewed changes and final comments |
|---|---|
cardano-wasm/demo/tests/wasm/README.md |
Documents regression test instructions. |
cardano-wasm/demo/tests/wasm/package.json |
Adds Node.js test dependency metadata. |
cardano-wasm/demo/tests/wasm/package-lock.json |
Locks Node.js dependencies. |
cardano-wasm/demo/tests/wasm/api-regression.mjs |
Adds wasm API regression tests. Moderate: Verify the fee in serialized CBOR rather than only checking transaction ID changes. Moderate: Verify the decoded stake-key witness or use a fixed CBOR vector instead of relying on length increase. |
cardano-wasm/demo/tests/CoreTest.elm |
Adds pure Elm core tests. Moderate: Use a JSON 404 with a different body to test the documented Blockfrost distinction. |
cardano-wasm/demo/README.md |
Documents the demo test suites. |
cardano-wasm/demo/elm.json |
Adds Elm test dependencies. |
cardano-wasm/demo/.gitignore |
Ignores Node.js dependencies. |
.github/workflows/haskell-wasm.yml |
Runs formatting, Elm tests, and Node.js regression tests in CI. |
.changes/20260718_cardano_wasm_demo_tests.yml |
Adds the changelog entry. |
Files not reviewed (1)
- cardano-wasm/demo/tests/wasm/package-lock.json: Generated file
Suppressed comments (4)
.github/workflows/haskell-wasm.yml:246
- Use
npm cihere instead ofnpm install. The latter can reconcilepackage.jsonandpackage-lock.jsonand silently test a dependency graph different from the committed lockfile, which undermines the reproducibility of this CI regression suite.
npm install
cardano-wasm/demo/tests/wasm/api-regression.mjs:248
- When the missing export is eventually fixed, this branch accepts any resolved value and only logs a note. Thus CI still will not verify that
newConwayTxreturns the advertisedUnsignedTxobject or that the returned value is usable. Keep the missing-export probe, but add a smoke assertion on the resolved object's type/methods (or replace this branch with a real constructor test).
await api.tx.newConwayTx();
cardano-wasm/demo/tests/wasm/api-regression.mjs:110
- This only checks that the ID has the right shape and remains stable. An implementation that returns a fixed 64-character string, or hashes the wrong bytes consistently, would pass; assert an independently known ID for a fixed transaction vector (as
cardano-wasm/npm-wrapper/api.test.jsdoes) before checking witness invariance.
const unsignedId = await tx.getTxId();
assert(
HEX64.test(unsignedId),
`unsigned txid not 64 lowercase hex: ${unsignedId}`
);
cardano-wasm/demo/tests/wasm/api-regression.mjs:144
- Checking only for the stake hash means all three certificate-maker tests can pass if they return the wrong certificate (for example, delegation to a different pool, or registration instead of unregistration). Assert the action-specific encoding and deposit/pool value, ideally using fixed certificate vectors.
certHex.includes(stakeKeyHash),
`certificate does not embed the stake key hash: ${certHex}`
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+297
to
+300
| , test "an arbitrary 404 page is not recognised as Blockfrost's not-found" <| | ||
| \_ -> | ||
| Blockfrost.isBlockfrostNotFound "<html>404 not found</html>" | ||
| |> Expect.equal False |
Comment on lines
+157
to
+161
| tx.setFee(fee); | ||
| const idAfterFee = await tx.getTxId(); | ||
| assert( | ||
| idAfterFee !== idBeforeFee, | ||
| "setting the fee should change the (body-hash) txid" |
Comment on lines
+179
to
+180
| cbor.length > cborOneSig.length, | ||
| "the stake signature should enlarge the witness set" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
tests/CoreTest.elm: 95 elm-test cases for the pure core (bech32 golden vectors from real pools plus negative vectors isolating each guard, ada<->lovelace round-trips, balance boundaries, certificate JSON, list helpers)tests/wasm/api-regression.mjs: 8 Node tests driving the freshly built lib-wrapper (wallet round-trip, getTxId stability, certificate round-trips asserting the cert, fee and witnesses end up in the signed CBOR, inspectAddress, newConwayTx broken-export probe)haskell-wasm.ymlruns elm-test with the demo build (elm-formatnow also validatestests/) and the regression suite right after itHow to trust this PR
It is all tests that pass. But it would be good to check that what is being tested makes sense, and it is tested the right way.
Checklist
.changes/