Repository navigation
tests: fill three genuine gaps in the smoke-test suite - #19
Open
ashishbhateja wants to merge 1 commit into
Open
ashishbhateja wants to merge 1 commit into
ashishbhateja wants to merge 1 commit into
Conversation
The previous collectThemes assertion compared the result against a dedup-and-sort of itself — a tautology that would pass even if theme normalisation were completely broken on the current sample data, because no two articles shared the same theme string. Replace it with a concrete test that feeds two articles with the same theme in different cases and asserts exactly two normalised, sorted entries come back. monthsOfMovement is exported from journey.js and called internally by asMovements, but had no direct assertion of its own. Add one that checks both the count and the calendar order of the 'ground' movement (five months, Jan–May). snippet(article) with an empty terms list is the natural default-parameter path; only the 'absent term' string case was covered. Add an explicit check that omitting terms falls back to the start of the text, matching the existing fallback contract.
This branch has not been deployed
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.
What and why
Three assertions in
scripts/smoke.mjswere either logically circular or simply absent, meaning real regressions in those code paths would go undetected by CI.1.
collectThemes— tautological assertion replaced with a concrete oneThe previous check compared the result against a dedup-and-sort of itself:
This is always true for any already-sorted, duplicate-free array — it proves nothing about whether
normalizeThemeactually collapses differently-cased variants. Because the sample edition uses consistent casing throughout, a completely broken normalizer would have passed.The new check feeds two articles with the same theme in different casings (
'Vedanta'and'vedanta') and asserts the output contains exactly two sorted, normalised entries — not three:2.
monthsOfMovement— exported API, zero direct coveragemonthsOfMovementis exported fromjourney.jsand called internally byasMovements, but it had no test of its own. If its sort or filter broke, theasMovementstest would still pass as long as the month count was right. The new check verifies both the length and the exact calendar order of the'ground'movement (five months, Jan–May).3.
snippetwith no terms — default-parameter path untestedsnippet(article, terms = [])has an explicit default of[]. The existing tests only covered['absentterm'](a term that simply isn't found). With an empty array the inner loop never runs, which is a distinct code path. The new check confirms the fallback to the start of the text still fires correctly.Result
19 checks → 22 checks, all passing.
npm run buildunaffected.Generated by Claude Code