From 91eaa6d8378d599613f41c95ec5f7343896eee48 Mon Sep 17 00:00:00 2001 From: dhgoal <153369624+dhgoal@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:30:51 +0900 Subject: [PATCH] test(enrichment): cover requirementTokens dedup, stopword, and alnum branches The single existing test only exercised length-based drops. Adds the uncovered branches: case-insensitive deduplication, a >=4-char word dropped by the stopword set (not the length floor), and alphanumeric tokens split on punctuation. Test-only. --- review-enrichment/test/history.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/review-enrichment/test/history.test.ts b/review-enrichment/test/history.test.ts index 38a16105f1..d7f377a5ad 100644 --- a/review-enrichment/test/history.test.ts +++ b/review-enrichment/test/history.test.ts @@ -322,6 +322,20 @@ test("requirementTokens drops short words and stopwords", () => { ]); }); +test("requirementTokens deduplicates case-insensitively", () => { + // Repeated words (any case) collapse to one token — the existing test has no repeats. + assert.deepEqual(requirementTokens("Cache cache CACHE storage"), ["cache", "storage"]); +}); + +test("requirementTokens drops a long-enough stopword via the stopword set, not the length floor", () => { + // `feature`/`should`/`support` are >= the 4-char floor, so they're dropped by the stopword check itself. + assert.deepEqual(requirementTokens("this feature should support caching"), ["caching"]); +}); + +test("requirementTokens keeps alphanumeric tokens and splits on punctuation", () => { + assert.deepEqual(requirementTokens("oauth2 retry-loop"), ["oauth2", "retry", "loop"]); +}); + test("classifyCoverage thresholds", () => { assert.equal(classifyCoverage("history analyzer enrichment", "history analyzer enrichment"), "full"); assert.equal(classifyCoverage("history analyzer enrichment", "history only"), "partial");