Skip to content

Build your personal knowledge base with Trilium Notes

test: port spec tests to vitest

Panagiotis Papadopoulos33274ada6534
diff --git a/spec/etapi/notes.spec.ts b/spec/etapi/notes.spec.ts
index bf7e0a2826..0d4772bf7f 100644
--- a/spec/etapi/notes.spec.ts
+++ b/spec/etapi/notes.spec.ts
@@ -1,3 +1,5 @@
-describe("Notes", () => {
+import { describe, it } from "vitest";
+
+describe.todo("Notes", () => {
it("zzz", () => {});
});
diff --git a/spec/search/lexer.spec.ts b/spec/search/lexer.spec.ts
index c489b03e6f..9f4a57482a 100644
--- a/spec/search/lexer.spec.ts
+++ b/spec/search/lexer.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import lex from "../../src/services/search/services/lex.js";
describe("Lexer fulltext", () => {
diff --git a/spec/search/parens.spec.ts b/spec/search/parens.spec.ts
index 33163e1885..2cfae9e6e8 100644
--- a/spec/search/parens.spec.ts
+++ b/spec/search/parens.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import handleParens from "../../src/services/search/services/handle_parens.js";
import type { TokenStructure } from "../../src/services/search/services/types.js";
diff --git a/spec/search/parser.spec.ts b/spec/search/parser.spec.ts
index 76e5570670..244fe62d2f 100644
--- a/spec/search/parser.spec.ts
+++ b/spec/search/parser.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import AndExp from "../../src/services/search/expressions/and.js";
import AttributeExistsExp from "../../src/services/search/expressions/attribute_exists.js";
import type Expression from "../../src/services/search/expressions/expression.js";
diff --git a/spec/search/search.spec.ts b/spec/search/search.spec.ts
index 0099546ad7..a25e18d280 100644
--- a/spec/search/search.spec.ts
+++ b/spec/search/search.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect, beforeEach, } from "vitest";
import searchService from "../../src/services/search/services/search.js";
import BNote from "../../src/becca/entities/bnote.js";
import BBranch from "../../src/becca/entities/bbranch.js";
@@ -21,7 +22,7 @@ describe("Search", () => {
});
});
- xit("simple path match", () => {
+ it.skip("simple path match", () => {
rootNote.child(becca_mocking.note("Europe").child(becca_mocking.note("Austria")));
const searchContext = new SearchContext();
@@ -31,7 +32,7 @@ describe("Search", () => {
expect(becca_mocking.findNoteByTitle(searchResults, "Austria")).toBeTruthy();
});
- xit("normal search looks also at attributes", () => {
+ it.skip("normal search looks also at attributes", () => {
const austria = becca_mocking.note("Austria");
const vienna = becca_mocking.note("Vienna");
@@ -49,7 +50,7 @@ describe("Search", () => {
expect(becca_mocking.findNoteByTitle(searchResults, "Vienna")).toBeTruthy();
});
- xit("normal search looks also at type and mime", () => {
+ it.skip("normal search looks also at type and mime", () => {
rootNote.child(becca_mocking.note("Effective Java", { type: "book", mime: "" })).child(becca_mocking.note("Hello World.java", { type: "code", mime: "text/x-java" }));
const searchContext = new SearchContext();
@@ -68,7 +69,7 @@ describe("Search", () => {
expect(searchResults.length).toEqual(2);
});
- xit("only end leafs are results", () => {
+ it.skip("only end leafs are results", () => {
rootNote.child(becca_mocking.note("Europe").child(becca_mocking.note("Austria")));
const searchContext = new SearchContext();
@@ -78,7 +79,7 @@ describe("Search", () => {
expect(becca_mocking.findNoteByTitle(searchResults, "Europe")).toBeTruthy();
});
- xit("only end leafs are results", () => {
+ it.skip("only end leafs are results", () => {
rootNote.child(becca_mocking.note("Europe").child(becca_mocking.note("Austria").label("capital", "Vienna")));
const searchContext = new SearchContext();
@@ -133,7 +134,7 @@ describe("Search", () => {
expect(becca_mocking.findNoteByTitle(searchResults, "Czech Republic")).toBeTruthy();
});
- xit("inherited label comparison", () => {
+ it.skip("inherited label comparison", () => {
rootNote.child(becca_mocking.note("Europe").label("country", "", true).child(becca_mocking.note("Austria")).child(becca_mocking.note("Czech Republic")));
const searchContext = new SearchContext();
@@ -549,7 +550,7 @@ describe("Search", () => {
expect(becca.notes[searchResults[0].noteId].title).toEqual("Europe");
});
- xit("test note.text *=* something", () => {
+ it.skip("test note.text *=* something", () => {
const italy = becca_mocking.note("Italy").label("capital", "Rome");
const slovakia = becca_mocking.note("Slovakia").label("capital", "Bratislava");
@@ -562,7 +563,7 @@ describe("Search", () => {
expect(becca.notes[searchResults[0].noteId].title).toEqual("Slovakia");
});
- xit("test that fulltext does not match archived notes", () => {
+ it.skip("test that fulltext does not match archived notes", () => {
const italy = becca_mocking.note("Italy").label("capital", "Rome");
const slovakia = becca_mocking.note("Slovakia").label("capital", "Bratislava");
diff --git a/spec/search/value_extractor.spec.ts b/spec/search/value_extractor.spec.ts
index 4155a7e51b..89a2c1389a 100644
--- a/spec/search/value_extractor.spec.ts
+++ b/spec/search/value_extractor.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect, beforeEach } from "vitest";
import becca_mocking from "./becca_mocking.js";
import ValueExtractor from "../../src/services/search/value_extractor.js";
import becca from "../../src/becca/becca.js";
diff --git a/spec/support/utils.spec.ts b/spec/support/utils.spec.ts
index 566e225d80..4c2c5566b1 100644
--- a/spec/support/utils.spec.ts
+++ b/spec/support/utils.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import { trimIndentation } from "./utils.js";
describe("Utils", () => {
diff --git a/src/services/export/md.spec.ts b/src/services/export/md.spec.ts
index 12f0d5b654..7ecbfbb777 100644
--- a/src/services/export/md.spec.ts
+++ b/src/services/export/md.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import markdownExportService from "./md.js";
import { trimIndentation } from "../../../spec/support/utils.js";
diff --git a/src/services/import/markdown.spec.ts b/src/services/import/markdown.spec.ts
index 73bad611b8..06d9c87d33 100644
--- a/src/services/import/markdown.spec.ts
+++ b/src/services/import/markdown.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import { trimIndentation } from "../../../spec/support/utils.js";
import markdownService from "./markdown.js";
diff --git a/src/share/content_renderer.spec.ts b/src/share/content_renderer.spec.ts
index d79cd78405..85d1c9ddee 100644
--- a/src/share/content_renderer.spec.ts
+++ b/src/share/content_renderer.spec.ts
@@ -1,3 +1,4 @@
+import { describe, it, expect } from "vitest";
import { renderCode, type Result } from "./content_renderer.js";
describe("content_renderer", () => {
@@ -8,7 +9,7 @@ describe("content_renderer", () => {
content: " "
};
renderCode(emptyResult);
- expect(emptyResult.isEmpty).toBeTrue();
+ expect(emptyResult.isEmpty).toBeTruthy();
});
it("identifies unsupported content type", () => {
@@ -17,7 +18,7 @@ describe("content_renderer", () => {
content: Buffer.from("Hello world")
};
renderCode(emptyResult);
- expect(emptyResult.isEmpty).toBeTrue();
+ expect(emptyResult.isEmpty).toBeTruthy();
});
it("wraps code in <pre>", () => {