feat: add unit test suite#786
Open
podrivo wants to merge 25 commits into
Open
Conversation
…der, and results modules; include test script in package.json
Open
…tegers and big-endian floats
…and A2S_PLAYER responses
…handling in ASE tests
…V and runWithUdpResponse helpers
…fo and player handling
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.
Refs #591
Problem
The project has no automated test suite. The shared byte parser (
lib/reader.js) and other core utilities are relied on by nearly all ~80 protocols, yet there's no safety net to catch regressions, nonpm testscript, and no CI job to run tests. See #591.Fix
Introduce a lightweight, zero-dependency unit test suite covering core parsing and utility logic, an
npm testscript, and a CI job to run it. No production code is changed — this PR only adds tests and wiring.Approach:
node:test+node:assert/strict. No new dependencies, no build step, works with the existing ESM setup.node --testauto-discovers**/*.test.jsrecursively, so the script and CI need no per-file wiring.What's covered:
^1and extended^XRRGGBBcolor codes, plus the disabled passthrough).CI: adds a
testjob to.github/workflows/node.ymlrunningnpm teston Node 18.x / 20.x / 22.x. (The built-in runner's auto-discovery is reliable on 18+; Node 16 stays covered by the existing build job.)Examples
Compatibility
node:testrunner with the existing ESM setup).Testing
npm test→ 7 test files, 16 suites, 55 tests, all passing.npm run lint:checkcurrently reports pre-existing failures on master in untouched files (the.eslintrc.jsonecmaVersion: 2021predates ES2022 syntax already in the code). This PR introduces zero new lint errors; fixing the pre-existing ones is a separate change.