Add automated test suite (node:test + jsdom)#241
Merged
Conversation
…xtures/legacy-html - Remove `test/` from .gitignore so the directory can hold real test files - Move legacy manual fixtures into test/fixtures/legacy-html/ - Add `test` script using `node --test --test-reporter=spec` - Add jsdom ^24.0.0 as devDependency
Was carried into the repo from the pre-existing untracked test1/ directory during Task 1's fixture move. Not a meaningful fixture.
Without an explicit glob, node --test recursively picks up everything under test/, including test/fixtures/generate.js and test/setup/jsdomEnv.js. The former actually re-ran on every `npm test`, overwriting the golden fixture with a new random IV. The latter was harmless noise but still "ran" as a 0-test file.
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.
Summary
node:testrunner — zero new runtime deps;jsdomis added as a devDependency for browser-runtime tests under a simulated DOM.decode()'s retry chain for old hashes, localStorage key names, URL-fragment autodecrypt format.No changes to
lib/orcli/source — this PR only adds tests, CI, and.gitignoreentries.What's tested
lib/cryptoEngine.js— primitives + each hash round pinned against golden fixtures (14 tests)lib/codec.js— happy-path encode/decode, wire format, tamper rejection (6 tests)lib/codec.jsretry chain — all 3 branches of the backward-compat path that lets oldremember-melocalStorage tokens still decrypt (4 tests)lib/formater.js— token substitution (7 tests)cli/helpers.jspure functions — the hand-rolled CommonJS→IIFE bundler, salt validation (7 tests)lib/staticryptJs.jsbrowser runtime under jsdom — decrypt path, remember-me, URL autodecrypt, logout (9 tests)Golden fixtures live in
test/fixtures/encrypted-blobs/basic.json. Regenerate withnode test/fixtures/generate.js(not run in CI).Test plan
npm testpasses locally (50 tests, ~2.5s)bash scripts/build.shstill produces a workingencrypted/test.htmltest/codec-compat.test.js— these are the most important (any failure here means a real regression in the backward-compat retry chain)