Skip to content

Build your personal knowledge base with Trilium Notes

chore(test): disable download of images

Elian Doranbd933dde28e9
diff --git a/src/services/import/single.spec.ts b/src/services/import/single.spec.ts
index 74b4746abd..c25e16bae5 100644
--- a/src/services/import/single.spec.ts
+++ b/src/services/import/single.spec.ts
@@ -1,4 +1,4 @@
-import { beforeAll, describe, expect, it } from "vitest";
+import { beforeAll, describe, expect, it, vi } from "vitest";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
@@ -42,6 +42,13 @@ async function testImport(fileName: string, mimetype: string) {
describe("processNoteContent", () => {
beforeAll(async () => {
+ // Prevent download of images.
+ vi.mock("../image.js", () => {
+ return {
+ default: { saveImageToAttachment: () => {} }
+ };
+ });
+
initializeTranslations();
sql_init.initializeDb();
await sql_init.dbReady;
diff --git a/src/services/import/zip.spec.ts b/src/services/import/zip.spec.ts
index 67f0175f34..4f6068c14a 100644
--- a/src/services/import/zip.spec.ts
+++ b/src/services/import/zip.spec.ts
@@ -1,4 +1,4 @@
-import { beforeAll, describe, expect, it } from "vitest";
+import { beforeAll, describe, expect, it, vi } from "vitest";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
@@ -37,6 +37,13 @@ async function testImport(fileName: string) {
describe("processNoteContent", () => {
beforeAll(async () => {
+ // Prevent download of images.
+ vi.mock("../image.js", () => {
+ return {
+ default: { saveImageToAttachment: () => {} }
+ };
+ });
+
initializeTranslations();
sql_init.initializeDb();
await sql_init.dbReady;