mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
An import with no input, or a Notion import with no shared pages, stayed in an active state with no tasks. This blocked new imports for the team until the creator canceled it.
29 lines
910 B
TypeScript
29 lines
910 B
TypeScript
import { ImportState, IntegrationService } from "@shared/types";
|
|
import { ImportTask } from "@server/models";
|
|
import { buildImport } from "@server/test/factories";
|
|
import JSONImportsProcessor from "./JSONImportsProcessor";
|
|
|
|
describe("JSONImportsProcessor", () => {
|
|
it("should error an import with no input", async () => {
|
|
const importModel = await buildImport({
|
|
service: IntegrationService.JSON,
|
|
input: [],
|
|
});
|
|
|
|
await new JSONImportsProcessor().perform({
|
|
name: "imports.create",
|
|
modelId: importModel.id,
|
|
teamId: importModel.teamId,
|
|
actorId: importModel.createdById,
|
|
ip: "127.0.0.1",
|
|
});
|
|
|
|
await importModel.reload();
|
|
expect(importModel.state).toEqual(ImportState.Errored);
|
|
expect(importModel.error).toEqual("Nothing to import");
|
|
expect(
|
|
await ImportTask.count({ where: { importId: importModel.id } })
|
|
).toEqual(0);
|
|
});
|
|
});
|