mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
change(web): clean up new test helper function
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
Some checks failed
Keyman Build Summary / Summarize build status checks (push) Has been cancelled
This commit is contained in:
parent
f9d73a38ce
commit
04b1e1bcff
1 changed files with 11 additions and 5 deletions
|
|
@ -1,3 +1,13 @@
|
|||
/*
|
||||
* Keyman is copyright (C) SIL Global. MIT License.
|
||||
*
|
||||
* Created by jahorton on 2026-03-11
|
||||
*
|
||||
* This file defines a unit-text helper designed to test what search-graph
|
||||
* results for corrections may result from paths traversing through a given
|
||||
* SearchQuotientNode.
|
||||
*/
|
||||
|
||||
import { PathResult, SearchQuotientNode } from "@keymanapp/lm-worker/test-index";
|
||||
|
||||
/**
|
||||
|
|
@ -42,8 +52,6 @@ export function analyzeQuotientNodeResults(
|
|||
node: SearchQuotientNode,
|
||||
expectedResults: string[]
|
||||
) {
|
||||
let matchCount = 0;
|
||||
|
||||
const matchMap: Map<string, number> = new Map();
|
||||
|
||||
let result: PathResult = node.handleNextNode();
|
||||
|
|
@ -51,9 +59,7 @@ export function analyzeQuotientNodeResults(
|
|||
if(result.type == 'complete') {
|
||||
const resultKey = result.finalNode.resultKey;
|
||||
if(expectedResults.find((entry) => entry == resultKey)) {
|
||||
matchCount++;
|
||||
|
||||
matchMap.set(resultKey, matchMap.get(resultKey) ?? 0 + 1);
|
||||
matchMap.set(resultKey, (matchMap.get(resultKey) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue