test: add caniuse and w3c route tests#501
Conversation
edc7b8d to
e977ed7
Compare
There was a problem hiding this comment.
Pull request overview
Adds new Jasmine test coverage around the caniuse helper logic/constants and the w3c/group route behavior, using temporary fixture data written under a per-test DATA_DIR.
Changes:
- Adds tests for
caniuseconstants andcreateResponseBody()browser filtering/version slicing. - Adds tests for
w3c/grouproute behavior (legacy shortname redirects, content negotiation, invalid type, error paths). - Introduces temporary on-disk fixtures for
caniuse/*.jsonandw3c/groups.jsonused by the routes at module load time.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| tests/routes/w3c/group.test.js | New tests for W3C group route behavior using a fixture groups.json. |
| tests/routes/caniuse/lib/index.test.js | New tests for caniuse constants and response formatting/filtering using a fixture feature JSON. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e977ed7 to
907c25f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1c1198f to
ac73ae0
Compare
ac73ae0 to
9c450d3
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds a setInterval that calls the update script daily and reloads the in-memory groups data from disk. Follows the existing pattern from xref's periodic cache invalidation. Also handles missing groups.json gracefully at startup (empty store instead of crash). Closes #395
Replace setInterval with self-scheduling setTimeout so the next refresh only fires after the current one completes. Add in-flight guard for safety. On startup JSON parse failure, trigger an immediate refreshGroups() to self-heal.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/cdec1a38-dd7f-40f8-8412-42208be2c16a Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
|
@copilot can you resolve any unaddressed concerns |
- Fix typo in SUPPORT_TITLES constant: "needs to enabled" → "needs to be enabled"
- Guard afterAll in group.test.js: only rm/restore if tmpDir/origDataDir are set
- Guard afterAll in caniuse index.test.js: same pattern
- Move HTTPError tests from group.test.js to tests/utils/misc.test.js
- Replace getSupportTitle reimplementation with actual HTML output assertions
via createResponseBody({format: "html"}) using fixture data with compound
and unknown support keys
Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/89d0a0b8-62d6-4426-ad6a-ed304d3b1ce1
Addressed all remaining concerns in 35dc30a:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Can you review this and fix any issues that come up? |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/speced/respec-web-services/sessions/728917e2-18ac-49b2-8ef9-9630dfdc2e9f Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Restructured per review feedback: - Use BackgroundTaskQueue with worker thread (matches xref/caniuse) - Only write groups.json on successful scrape - Add POST /w3c/update endpoint for cron-triggered refreshes - Remove inline setTimeout/setInterval timer
Remove redundant existsSync guards (readFileSync throws into catch). Add authGithubWebhook middleware to POST /w3c/update to prevent spam. Add W3C_GROUPS_SECRET to .env.sample. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The reloadGroups() return value was silently discarded, so a successful scrape followed by a failed reload would return 200. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests valid reload (returns true, updates in-memory groups), missing file (returns false, preserves previous data), and corrupt JSON (returns false, preserves previous data). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@copilot can you resolve the merge conflicts? |
# Conflicts: # tests/utils/misc.test.js Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Merge conflicts resolved in a1cb402. The only conflict was in
Reviewed and all tests pass (159 specs, 0 failures). No issues found after the merge with main — the code review and CodeQL scan both came back clean. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary