From 370928c8e5aa7f638cd64ab50e72ace3e2ea3fd3 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Mon, 22 Jun 2026 15:55:03 -0500 Subject: [PATCH] change(web): clean ContextState unit tests Addresses these comments: - https://github.com/keymanapp/keyman/issues/15265#issuecomment-3636890802 - https://github.com/keymanapp/keyman/issues/15265#issuecomment-3636901217 Build-bot: skip build:web Test-bot: skip --- .../context/context-state.tests.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/context/context-state.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/context/context-state.tests.ts index 5e57900477..d1346e8214 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/context/context-state.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/context/context-state.tests.ts @@ -98,14 +98,6 @@ describe('ContextState', () => { let newContextMatch = baseState.analyzeTransition(newContext, toWrapperDistribution(transform)); assert.isNotNull(newContextMatch?.final); assert.deepEqual(newContextMatch.final.tokenization.tokens.map(token => token.exampleInput), rawTokens); - - // // Phrased this way to facilitate TS type-inference; assert.isTrue() does - // // NOT do this for us! - // if(!newContextMatch.final.tokenization.alignment.canAlign) { - // assert.fail("context alignment failed"); - // } - // assert.equal(newContextMatch.final.tokenization.alignment.leadTokenShift, 0); - // assert.equal(newContextMatch.final.tokenization.alignment.tailTokenShift, 0); }); it("properly matches and aligns when no context changes occur (after whitespace)", function() { @@ -125,14 +117,6 @@ describe('ContextState', () => { let newContextMatch = baseState.analyzeTransition(newContext, toWrapperDistribution(transform)); assert.isNotNull(newContextMatch?.final); assert.deepEqual(newContextMatch.final.tokenization.tokens.map(token => token.exampleInput), rawTokens); - - // // Phrased this way to facilitate TS type-inference; assert.isTrue() does - // // NOT do this for us! - // if(!newContextMatch.final.tokenization.alignment.canAlign) { - // assert.fail("context alignment failed"); - // } - // assert.equal(newContextMatch.final.tokenization.alignment.leadTokenShift, 0); - // assert.equal(newContextMatch.final.tokenization.alignment.tailTokenShift, 0); }); it("properly matches and aligns when lead token is removed (end of word)", function() { @@ -437,7 +421,7 @@ describe('ContextState', () => { }); }); -describe('determineContextSlideDeltas', () => { +describe('determineContextSlideTransform', () => { it('finds prefixed text for backward sliding context window', () => { const before: Context = { left: 'ples and bananas',