Merge pull request #16125 from keymanapp/change/web/clean-context-state-tests

change(web): clean ContextState unit tests 🚂
This commit is contained in:
Joshua Horton 2026-06-24 00:42:04 +07:00 • committed by GitHub
commit bec08f5c8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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',