Skip to content

Expand test coverage using node:test#21

Merged
danielbeardsley merged 3 commits into
masterfrom
tests/expand-coverage
May 7, 2026
Merged

Expand test coverage using node:test#21
danielbeardsley merged 3 commits into
masterfrom
tests/expand-coverage

Conversation

@danielbeardsley
Copy link
Copy Markdown
Member

@danielbeardsley danielbeardsley commented May 7, 2026

Summary

  • Switch tests to target src/translations.js directly (not the babel-built dist/) using Node's built-in node:test runner
  • Cover all three exports: _js (lookup, whitespace compaction, single/multi/repeated %N placeholders, non-string coercion, window.App.showTranslatedPlaceholder short-circuit), ___p (singular/plural branches incl. 0, arg forwarding), and setTranslations (replacement)
  • Add test/test-uninitialized.mjs in a separate file so the UITranslations === null fallback path can be exercised on a fresh module load (node --test runs each file in its own process)

Test plan

  • npm test — 17 tests pass across both files

qa_req 0 (CI is enough)

Test src/translations.js directly (not the babel-built dist) and cover
all three exported functions including window-dependent branches and
the uninitialized-translations fallback path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
masonmcelvain
masonmcelvain previously approved these changes May 7, 2026
Copy link
Copy Markdown

@masonmcelvain masonmcelvain left a comment

Choose a reason for hiding this comment

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

CR 👍🏻

Comment thread test/test-uninitialized.mjs
It says this is a module type but complains since we don't declare it.
Without clearing the state to undefined, we weren't actually seeing the
errors get added.
Copy link
Copy Markdown

@masonmcelvain masonmcelvain left a comment

Choose a reason for hiding this comment

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

CR 👍🏻

@danielbeardsley danielbeardsley merged commit 51bb523 into master May 7, 2026
1 check passed
@danielbeardsley danielbeardsley deleted the tests/expand-coverage branch May 7, 2026 21:24
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