Notes/spec/etapi/import.ts

26 lines
935 B
TypeScript
Raw Normal View History

import etapi from "../support/etapi.js";
import fs from "fs";
import path from "path";
2024-07-19 00:18:35 +03:00
import { fileURLToPath } from "url";
2024-05-03 21:18:20 +02:00
/* TriliumNextTODO: port to Vitest
2024-05-03 21:18:20 +02:00
etapi.describeEtapi("import", () => {
2025-01-09 18:07:02 +02:00
// temporarily skip this test since test-export.zip is missing
xit("import", async () => {
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
2024-07-19 00:18:35 +03:00
2025-01-09 18:07:02 +02:00
const zipFileBuffer = fs.readFileSync(path.resolve(scriptDir, "test-export.zip"));
2024-05-03 21:18:20 +02:00
2025-01-09 18:07:02 +02:00
const response = await etapi.postEtapiContent("notes/root/import", zipFileBuffer);
expect(response.status).toEqual(201);
2024-05-03 21:18:20 +02:00
2025-01-09 18:07:02 +02:00
const { note, branch } = await response.json();
2024-05-03 21:18:20 +02:00
2025-01-09 18:07:02 +02:00
expect(note.title).toEqual("test-export");
expect(branch.parentNoteId).toEqual("root");
2024-05-03 21:18:20 +02:00
2025-01-09 18:07:02 +02:00
const content = await (await etapi.getEtapiContent(`notes/${note.noteId}/content`)).text();
expect(content).toContain("test export content");
});
2024-05-03 21:18:20 +02:00
});
*/