diff --git a/web/src/engine/predictive-text/worker-thread/build.sh b/web/src/engine/predictive-text/worker-thread/build.sh index 0b950479b63..5d3289ac073 100755 --- a/web/src/engine/predictive-text/worker-thread/build.sh +++ b/web/src/engine/predictive-text/worker-thread/build.sh @@ -24,6 +24,7 @@ SRCMAP_CLEANER="${KEYMAN_ROOT}/web/build/tools/building/sourcemap-root/index.js" ################################ Main script ################################ SUBPROJECT_NAME=engine/predictive-text/worker-thread +SUBPROJECT_HELPERS=engine/predictive-text/helpers builder_describe \ "Compiles the Language Modeling Layer for common use in predictive text and autocorrective applications." \ @@ -103,6 +104,7 @@ function do_test() { WTR_INSPECT=" --manual" fi + test-headless-typescript $SUBPROJECT_HELPERS test-headless-typescript $SUBPROJECT_NAME web-test-runner --config ./src/tests/test-runner/web-test-runner${WTR_CONFIG}.config.mjs ${WTR_INSPECT} diff --git a/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.tests.ts b/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.tests.ts index b680159c044..91198443786 100644 --- a/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.tests.ts @@ -9,10 +9,9 @@ import { assert } from "chai"; -import { SearchQuotientNode } from "@keymanapp/lm-worker/test-index"; +import { SearchQuotientNode, SearchQuotientSpur } from "@keymanapp/lm-worker/test-index"; import { constituentPaths } from "./constituentPaths.js"; -import { quotientPathHasInputs } from "./quotientPathHasInputs.js"; import { buildAlphabeticClusterFixtures } from "./buildAlphabeticClusteredFixture.js"; describe('buildAlphabeticClusteredFixture() fixture', () => { @@ -24,7 +23,10 @@ describe('buildAlphabeticClusteredFixture() fixture', () => { const allDists = Object.values(distributions).map(set => Object.values(set)).flat(); const finalClusterPaths = constituentPaths(clusters.cluster_k5c6) as SearchQuotientNode[][]; - allPaths.forEach((spur) => assert.isOk(finalClusterPaths.find(seq => seq.indexOf(spur) > -1))); - allDists.forEach((dist) => assert.isOk(allPaths.find(path => quotientPathHasInputs(path, [dist])))); + allPaths + // This one path doesn't get clustered; it's the only way to reach excess length in this fixture. + .filter((spur) => spur != paths[4].path_k4c6) + .forEach((spur) => assert.isOk(finalClusterPaths.find(seq => seq.indexOf(spur) > -1), `spur ${spur.spaceId} is disconnected`)); + allDists.forEach((dist) => assert.isOk(allPaths.find(path => (path as SearchQuotientSpur).inputs == dist), `distribution ${JSON.stringify(dist)} has no matching path`)); }); }); \ No newline at end of file diff --git a/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.ts b/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.ts index d45cffc7e4c..e330eb51d8e 100644 --- a/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.ts +++ b/web/src/test/auto/headless/engine/predictive-text/helpers/buildAlphabeticClusteredFixture.ts @@ -163,10 +163,8 @@ export const buildAlphabeticClusterFixtures = () => { distrib_c3_i2d0 } }, + root: rootPath, paths: { - 0: { - rootPath - }, 1: { path_k1c1_i1d0, path_k1c2_i2d0, diff --git a/web/src/test/auto/headless/engine/predictive-text/helpers/constituentPaths.tests.ts b/web/src/test/auto/headless/engine/predictive-text/helpers/constituentPaths.tests.ts index 30cac6a53a9..d3df0742d50 100644 --- a/web/src/test/auto/headless/engine/predictive-text/helpers/constituentPaths.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/helpers/constituentPaths.tests.ts @@ -89,7 +89,7 @@ describe('constituentPaths', () => { return type == 'insert' && typeSeq[index+1] == 'delete'; }); }); - assert.isNotOk(shouldOccur); + assert.isOk(shouldOccur); }); }); }); \ No newline at end of file diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-cluster.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-cluster.tests.ts index 029aa6bed31..421b3df1fdc 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-cluster.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/search-quotient-cluster.tests.ts @@ -808,7 +808,7 @@ describe('SearchQuotientCluster', () => { const mergeResult = baseCluster.merge(new LegacyQuotientSpur( // Is (and mocks) the head result from `path_k4c4_i1.split(3)`. - fixture.paths[0].rootPath, + fixture.root, // Mocks the tail result from `path_k4c4_i1.split(3)`. fixture.distributions[4].distrib_c2_i1d0, { segment: {