refactoring to allow unit tests of the whole search subsystem

This commit is contained in:
zadam
2020-05-21 14:05:56 +02:00
parent a06662f4ce
commit cd48135394
9 changed files with 42 additions and 32 deletions

View File

@@ -6,7 +6,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: ["hello", "hi"],
expressionTokens: [],
parsingContext: new ParsingContext(false)
parsingContext: new ParsingContext({includeNoteContent: false})
});
expect(rootExp.constructor.name).toEqual("NoteCacheFulltextExp");
@@ -17,7 +17,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: ["hello", "hi"],
expressionTokens: [],
parsingContext: new ParsingContext(true)
parsingContext: new ParsingContext({includeNoteContent: true})
});
expect(rootExp.constructor.name).toEqual("OrExp");
@@ -34,7 +34,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: [],
expressionTokens: ["#mylabel", "=", "text"],
parsingContext: new ParsingContext(true)
parsingContext: new ParsingContext()
});
expect(rootExp.constructor.name).toEqual("FieldComparisonExp");
@@ -64,7 +64,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: [],
expressionTokens: ["#first", "=", "text", "#second", "=", "text"],
parsingContext: new ParsingContext(true)
parsingContext: new ParsingContext()
});
expect(rootExp.constructor.name).toEqual("AndExp");
@@ -81,7 +81,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: [],
expressionTokens: ["#first", "=", "text", "OR", "#second", "=", "text"],
parsingContext: new ParsingContext(true)
parsingContext: new ParsingContext()
});
expect(rootExp.constructor.name).toEqual("OrExp");
@@ -98,7 +98,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: ["hello"],
expressionTokens: ["#mylabel", "=", "text"],
parsingContext: new ParsingContext(false)
parsingContext: new ParsingContext()
});
expect(rootExp.constructor.name).toEqual("AndExp");
@@ -115,7 +115,7 @@ describe("Parser", () => {
const rootExp = parser({
fulltextTokens: [],
expressionTokens: ["#first", "=", "text", "OR", ["#second", "=", "text", "AND", "#third", "=", "text"]],
parsingContext: new ParsingContext(false)
parsingContext: new ParsingContext()
});
expect(rootExp.constructor.name).toEqual("OrExp");