mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-19 02:10:04 +08:00
refactor(test): remove need for async import
This commit is contained in:
parent
f646e0f724
commit
2531e5617f
@ -1,8 +1,9 @@
|
||||
import { beforeAll, vi } from "vitest";
|
||||
import $ from "jquery";
|
||||
|
||||
injectGlobals();
|
||||
|
||||
beforeAll(() => {
|
||||
injectGlobals();
|
||||
vi.mock("./services/ws.js", mockWebsocket);
|
||||
vi.mock("./services/server.js", mockServer);
|
||||
});
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { describe, it } from "vitest";
|
||||
import utils from "../../services/utils.js";
|
||||
import FNote from "../../entities/fnote.js";
|
||||
import froca from "../../services/froca.js";
|
||||
import FAttribute from "../../entities/fattribute.js";
|
||||
|
||||
interface NoteDefinition {
|
||||
title: string;
|
||||
@ -10,10 +13,6 @@ async function buildNotes(notes: NoteDefinition[]) {
|
||||
const ids = [];
|
||||
|
||||
for (const noteDef of notes) {
|
||||
const FNote = (await import("../../entities/fnote.js")).default;
|
||||
const FAttribute = (await import("../../entities/fattribute.js")).default;
|
||||
const froca = (await import("../../services/froca.js")).default;
|
||||
|
||||
const fakeNoteId = utils.randomString(6);
|
||||
const note = new FNote(froca, {
|
||||
noteId: fakeNoteId,
|
||||
@ -57,8 +56,6 @@ describe("Building events", () => {
|
||||
]);
|
||||
|
||||
// import CalendarView from "./calendar_view.js";
|
||||
const FNote = (await import("../../entities/fnote.js")).default;
|
||||
const froca = (await import("../../services/froca.js"));
|
||||
const CalendarView = (await import("./calendar_view.js")).default;
|
||||
const events = await CalendarView.buildEvents(noteIds);
|
||||
console.log(noteIds, events);
|
||||
|
Loading…
x
Reference in New Issue
Block a user