mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-20 02:51:40 +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 { beforeAll, vi } from "vitest";
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
|
injectGlobals();
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
injectGlobals();
|
|
||||||
vi.mock("./services/ws.js", mockWebsocket);
|
vi.mock("./services/ws.js", mockWebsocket);
|
||||||
vi.mock("./services/server.js", mockServer);
|
vi.mock("./services/server.js", mockServer);
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import { describe, it } from "vitest";
|
import { describe, it } from "vitest";
|
||||||
import utils from "../../services/utils.js";
|
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 {
|
interface NoteDefinition {
|
||||||
title: string;
|
title: string;
|
||||||
@ -10,10 +13,6 @@ async function buildNotes(notes: NoteDefinition[]) {
|
|||||||
const ids = [];
|
const ids = [];
|
||||||
|
|
||||||
for (const noteDef of notes) {
|
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 fakeNoteId = utils.randomString(6);
|
||||||
const note = new FNote(froca, {
|
const note = new FNote(froca, {
|
||||||
noteId: fakeNoteId,
|
noteId: fakeNoteId,
|
||||||
@ -57,8 +56,6 @@ describe("Building events", () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// import CalendarView from "./calendar_view.js";
|
// 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 CalendarView = (await import("./calendar_view.js")).default;
|
||||||
const events = await CalendarView.buildEvents(noteIds);
|
const events = await CalendarView.buildEvents(noteIds);
|
||||||
console.log(noteIds, events);
|
console.log(noteIds, events);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user