Commit 33b7f68
Added Node.js unit tests for core JavaScript utilities (#636)
* Added Node.js unit tests for core JavaScript utilities
Added tests for utils.js (unaccented, UpdateQueryString, locationOf,
sortedInsert, Ranges) and buggytrack.js (cyrb53) using Node's built-in
test runner. Zero new dependencies.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Address review feedback: relocate tests, improve assertions, add coverage
- Moved test files from test/ to assets/js/tests/ (closer to source)
- Added assets/js/tests/ to _config.yml exclude list
- Updated categoryName tests to validate HTML structure instead of specific names
- Added tests for addMatchHighlights and getBlurbForResult
- Added inline comments explaining why vm.createContext needs explicit globals
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: load search_functions.js directly, add handleSearchMessage tests
Address review feedback:
- Remove extractFunction parser since search_functions.js now exists
as a standalone file (after #637 merged)
- Load search_functions.js directly via vm sandbox
- Add handleSearchMessage tests covering: stop word handling,
+prefix logic, fallback search, filterquery filtering,
and result structure validation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: add +-, --, -+ prefix combination tests for handleSearchMessage
Address review feedback from khemarato: add test cases covering
all prefix combinations to verify existing +/- prefixes are preserved.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: address review feedback — add html-validate and missing test cases
* fix(test): add HTML validation in categoryName loop + flip assertion order
Address review nits:
- Add assertValidHtml() for every category in the knownCategories loop
- Flip assertion order in "finds the section with the most matches" to
catch incorrect greedy implementations by checking the negative first
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(search): use numeric for-loop instead of for-in on positions array
for (var i in positions) yields string keys ("0", "1", ...),
causing j = i + 1 to produce "01" (string concatenation) instead
of 1 (numeric addition). This made the inner while-loop skip
positions[1] for i=0 and exit immediately for all other starting
indices, so the algorithm always selected the first match's window
regardless of where the densest cluster was.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test(search): flip test data to catch greedy blurb selection
Place the lone IGNORE match before the cluster (MATCH, ME, INSTEAD)
so that a greedy algorithm picking the first match would fail.
Also add assertValidHtml() in the categoryName loop per review.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent bfe89ad commit 33b7f68
7 files changed
Lines changed: 928 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
0 commit comments