test: add hermetic unit suite and wire it into CI#201760
Open
victalejo wants to merge 1 commit into
Open
Conversation
splits tests/ into two tiers so CI actually runs tests on every push. - tests/unit/ — 74 hermetic tests (~150 ms) covering structures, factories, Util, web cache backends, and auth strategies. No Chromium, no network, no WhatsApp session required. - tests/integration/ — the existing E2E suite, unchanged in behavior; moved with `git mv` to preserve history. also fixes the Tests workflow, which was mis-wired to run `npm run lint` (duplicating lint.yml). It now runs the unit suite across Node 18/20/22. package.json: - npm test → test:unit (new default; previously failed without a phone) - npm run test:unit → fast suite - npm run test:integration → existing E2E suite
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
Splits
tests/into two tiers so CI actually runs tests on every push:tests/unit/— 74 hermetic tests (~150 ms) covering structures, factories,Util, web cache backends, and auth strategies. No Chromium, no network,no WhatsApp session required.
tests/integration/— the existing E2E suite, unchanged in behavior; movedwith
git mvto preserve history.Also fixes the
Testsworkflow, which was mis-wired to runnpm run lint(duplicating
lint.yml). It now runs the unit suite across Node 18 / 20 / 22.Changes
tests/unit/covering:Location,Poll,Label,Reaction,Buttons,List,MessageMedia(constructor +fromFilePath+fromUrlmime guard)Util.generateHash,Util.mergeDefault, constructor guardLocalAuth(clientId validation, path resolution,beforeBrowserInitializedin a temp dir),
NoAuthWebCache,LocalWebCache(persist/resolve/strict),RemoteWebCacheconstructor validation,
WebCacheFactoryChatFactory,ContactFactorypackage.json:npm test→test:unit(new default; previously failed without a realphone number)
npm run test:unit→ fast suitenpm run test:integration→ existing E2E suite.github/workflows/tests.yml: runsnpm run test:uniton Node 18/20/22with npm caching, instead of duplicating the lint job.
tests/README.mdexplaining the two tiers,tests/integration/README.mdupdated with the new command.