test: port spec tests to vitest

This commit is contained in:
Panagiotis Papadopoulos 2025-01-13 00:32:58 +01:00
parent 6be7109ce3
commit 33274ada65
10 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,5 @@
describe("Notes", () => {
import { describe, it } from "vitest";
describe.todo("Notes", () => {
it("zzz", () => {});
});

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import lex from "../../src/services/search/services/lex.js";
describe("Lexer fulltext", () => {

View File

@ -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";

View File

@ -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";

View File

@ -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");

View File

@ -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";

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import { trimIndentation } from "./utils.js";
describe("Utils", () => {

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import markdownExportService from "./md.js";
import { trimIndentation } from "../../../spec/support/utils.js";

View File

@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import { trimIndentation } from "../../../spec/support/utils.js";
import markdownService from "./markdown.js";

View File

@ -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>", () => {