mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	more tests
This commit is contained in:
		@@ -60,7 +60,7 @@ describe("Lexer expression", () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it("dot separated properties", () => {
 | 
			
		||||
        expect(lexer(`# ~author.title = 'Hugh Howey' AND note.title = 'Silo'`).expressionTokens)
 | 
			
		||||
            .toEqual(["#", "~author", ".", "title", "=", "hugh howey", "and", "note", ".", "title", "=", "silo"]);
 | 
			
		||||
        expect(lexer(`# ~author.title = 'Hugh Howey' AND note.'book title' = 'Silo'`).expressionTokens)
 | 
			
		||||
            .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 () => {
 | 
			
		||||
        // dates should not be coerced into numbers which would then give wrong numbers
 | 
			
		||||
 | 
			
		||||
        rootNote
 | 
			
		||||
            .child(note("Europe")
 | 
			
		||||
                .label('country', '', true)
 | 
			
		||||
@@ -114,14 +116,19 @@ describe("Search", () => {
 | 
			
		||||
                .child(note("Czech Republic")
 | 
			
		||||
                    .label('established', '1993-01-01'))
 | 
			
		||||
                .child(note("Hungary")
 | 
			
		||||
                    .label('established', '..wrong..'))
 | 
			
		||||
                    .label('established', '1920-06-04'))
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        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(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, "Czech Republic")).toBeTruthy();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it("logical or", async () => {
 | 
			
		||||
@@ -389,7 +396,7 @@ describe("Search", () => {
 | 
			
		||||
 | 
			
		||||
        await test("relationCount", "1", 1);
 | 
			
		||||
        await test("relationCount", "2", 0);
 | 
			
		||||
    })
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/** @return {Note} */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user