mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-29 03:37:42 +00:00
fix(web): address most PR review concerns
Covers unit test names, describe => it for one case, and consistency in an error case between spurs and roots.
This commit is contained in:
parent
052f1f1f70
commit
eb958fa4de
3 changed files with 7 additions and 3 deletions
|
|
@ -68,7 +68,7 @@ export class SearchQuotientRoot implements SearchQuotientNode {
|
|||
*/
|
||||
public handleNextNode(): PathResult {
|
||||
if(this.hasBeenProcessed) {
|
||||
return null;
|
||||
return { type: 'none' };
|
||||
}
|
||||
|
||||
this.hasBeenProcessed = true;
|
||||
|
|
|
|||
|
|
@ -171,6 +171,10 @@ export abstract class SearchQuotientSpur implements SearchQuotientNode {
|
|||
// spaces are in sequence here.
|
||||
// `this` = head 'space'.
|
||||
public merge(space: SearchQuotientNode): SearchQuotientNode {
|
||||
if(this.model != space.model) {
|
||||
throw new Error("Cannot merge search graphs based on different LexicalModels");
|
||||
}
|
||||
|
||||
// Head node for the incoming path is empty, so skip it.
|
||||
if(space.parents.length == 0 || space instanceof SearchQuotientRoot) {
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import TrieModel = models.TrieModel;
|
|||
const testModel = new TrieModel(jsonFixture('models/tries/english-1000'));
|
||||
const altModel = new TrieModel(jsonFixture('models/tries/accented'));
|
||||
|
||||
describe('SearchQuotientSpur', () => {
|
||||
describe('SearchQuotientRoot', () => {
|
||||
describe('constructor', () => {
|
||||
it('initializes from a lexical model', () => {
|
||||
const path = new SearchQuotientRoot(testModel);
|
||||
|
|
@ -44,7 +44,7 @@ describe('SearchQuotientSpur', () => {
|
|||
assert.deepEqual(constituentPaths(path), []);
|
||||
});
|
||||
|
||||
describe('.isSameNode returns true for separate instance on same model', () => {
|
||||
it('.isSameNode returns true for separate instance on same model', () => {
|
||||
const root1 = new SearchQuotientRoot(testModel);
|
||||
const root2 = new SearchQuotientRoot(testModel);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue