This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/server/commands/documentBatchImporter.test.js

36 lines
953 B
JavaScript
Raw Normal View History

2020-12-18 05:19:31 +00:00
// @flow
import path from "path";
import File from "formidable/lib/file";
import { buildUser } from "../test/factories";
import { flushdb } from "../test/support";
import documentBatchImporter from "./documentBatchImporter";
jest.mock("../utils/s3");
beforeEach(() => flushdb());
describe("documentBatchImporter", () => {
const ip = "127.0.0.1";
it("should import documents in outline format", async () => {
const user = await buildUser();
const name = "outline.zip";
const file = new File({
name,
type: "application/zip",
path: path.resolve(__dirname, "..", "test", "fixtures", name),
});
2020-12-24 18:18:53 +00:00
const response = await documentBatchImporter({
2020-12-18 05:19:31 +00:00
type: "outline",
user,
file,
ip,
});
2020-12-24 18:18:53 +00:00
expect(Object.keys(response.collections).length).toEqual(1);
2020-12-26 02:04:38 +00:00
expect(Object.keys(response.documents).length).toEqual(8);
2020-12-24 18:18:53 +00:00
expect(Object.keys(response.attachments).length).toEqual(6);
2020-12-18 05:19:31 +00:00
});
});