2024-07-18 21:35:17 +03:00
|
|
|
import etapi from "../support/etapi.js";
|
2024-07-18 21:37:45 +03:00
|
|
|
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
|
|
|
|
2025-02-14 08:01:30 +01: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
|
|
|
});
|
2025-03-02 20:47:57 +01:00
|
|
|
*/
|