mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
more tests
This commit is contained in:
parent
a2e1fb35b8
commit
8ce2afff8a
@ -60,7 +60,7 @@ describe("Lexer expression", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("dot separated properties", () => {
|
it("dot separated properties", () => {
|
||||||
expect(lexer(`# ~author.title = 'Hugh Howey' AND note.title = 'Silo'`).expressionTokens)
|
expect(lexer(`# ~author.title = 'Hugh Howey' AND note.'book title' = 'Silo'`).expressionTokens)
|
||||||
.toEqual(["#", "~author", ".", "title", "=", "hugh howey", "and", "note", ".", "title", "=", "silo"]);
|
.toEqual(["#", "~author", ".", "title", "=", "hugh howey", "and", "note", ".", "book title", "=", "silo"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -106,6 +106,8 @@ describe("Search", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("numeric label comparison fallback to string comparison", async () => {
|
it("numeric label comparison fallback to string comparison", async () => {
|
||||||
|
// dates should not be coerced into numbers which would then give wrong numbers
|
||||||
|
|
||||||
rootNote
|
rootNote
|
||||||
.child(note("Europe")
|
.child(note("Europe")
|
||||||
.label('country', '', true)
|
.label('country', '', true)
|
||||||
@ -114,14 +116,19 @@ describe("Search", () => {
|
|||||||
.child(note("Czech Republic")
|
.child(note("Czech Republic")
|
||||||
.label('established', '1993-01-01'))
|
.label('established', '1993-01-01'))
|
||||||
.child(note("Hungary")
|
.child(note("Hungary")
|
||||||
.label('established', '..wrong..'))
|
.label('established', '1920-06-04'))
|
||||||
);
|
);
|
||||||
|
|
||||||
const parsingContext = new ParsingContext();
|
const parsingContext = new ParsingContext();
|
||||||
|
|
||||||
const searchResults = await searchService.findNotesWithQuery('#established < 1990', parsingContext);
|
let searchResults = await searchService.findNotesWithQuery('#established <= 1955-01-01', parsingContext);
|
||||||
expect(searchResults.length).toEqual(1);
|
expect(searchResults.length).toEqual(1);
|
||||||
|
expect(findNoteByTitle(searchResults, "Hungary")).toBeTruthy();
|
||||||
|
|
||||||
|
searchResults = await searchService.findNotesWithQuery('#established > 1955-01-01', parsingContext);
|
||||||
|
expect(searchResults.length).toEqual(2);
|
||||||
expect(findNoteByTitle(searchResults, "Austria")).toBeTruthy();
|
expect(findNoteByTitle(searchResults, "Austria")).toBeTruthy();
|
||||||
|
expect(findNoteByTitle(searchResults, "Czech Republic")).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logical or", async () => {
|
it("logical or", async () => {
|
||||||
@ -389,7 +396,7 @@ describe("Search", () => {
|
|||||||
|
|
||||||
await test("relationCount", "1", 1);
|
await test("relationCount", "1", 1);
|
||||||
await test("relationCount", "2", 0);
|
await test("relationCount", "2", 0);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/** @return {Note} */
|
/** @return {Note} */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user