Skip to content

W-23516608: Add unit tests for extracted DataWeave Node.js binding modules#131

Merged
mlischetti merged 1 commit into
masterfrom
W-23516608-unit-tests-extracted-modules
Jul 20, 2026
Merged

W-23516608: Add unit tests for extracted DataWeave Node.js binding modules#131
mlischetti merged 1 commit into
masterfrom
W-23516608-unit-tests-extracted-modules

Conversation

@mlischetti

Copy link
Copy Markdown
Contributor

What

Adds unit tests for the pure modules extracted in W-23516605 (#130), expanding the Group A unit lane.
No src/ changes — additive tests only, no dwlib required.

Tests added

File Count Covers
tests/unit/reader.test.ts 14 createChunkReader over sync & async iterables — bufSize boundary slicing, empty input, empty-buffer skipping, Uint8Array chunks, copy semantics, async pre-buffering, input-error-as-EOF
tests/unit/stream.test.ts 6 streamFromNative bridge — chunk ordering, the park-then-wake backpressure path, drain-after-done, and success/failure/empty terminal-metadata propagation (native call injected, no addon)
tests/unit/errors.test.ts 5 DataWeaveError / DataWeaveScriptError — name, instanceof chain, message fallback, attached result

Results

  • npm run test:unit60 passed (was 35)
  • Unit-lane coverage over src/**: ~39% → ~72% (errors.ts 100%, reader.ts 100%, stream.ts ~95%)
  • dataweave.ts / index.ts remain integration-lane surface (Group B), by design

Follow-ups

  • Group B — integration tests (concurrency, error/edge matrix) covering dataweave.ts

  • Group C — TCK harness + skip mechanism

    🤖 Generated with Claude Code

Add unit tests for the pure modules extracted in W-23516605, expanding the
Group A unit lane (no dwlib required). No src/ changes.

- reader.test.ts (14): createChunkReader over sync and async iterables —
  bufSize boundary slicing, empty input, empty-buffer skipping, Uint8Array
  chunks, copy semantics, async pre-buffering, and input-error-as-EOF.
- stream.test.ts (6): streamFromNative bridge — chunk ordering, the
  park-then-wake backpressure path, drain-after-done, and success/failure/
  empty terminal metadata propagation (native call injected, no addon).
- errors.test.ts (5): DataWeaveError / DataWeaveScriptError — name,
  instanceof chain, message fallback, and attached result.

Unit tests: 35 -> 60 passing. Unit-lane coverage over src/** rises from
~39% to ~72% (errors 100%, reader 100%, stream ~95%). dataweave.ts/index.ts
remain integration-lane surface (Group B).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mlischetti
mlischetti requested a review from a team as a code owner July 20, 2026 19:26
@mlischetti
mlischetti merged commit 39b619a into master Jul 20, 2026
3 checks passed
@mlischetti
mlischetti deleted the W-23516608-unit-tests-extracted-modules branch July 20, 2026 19:43
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.

2 participants