Files
outline/server/queues/processors/JSONImportsProcessor.test.ts
Tom Moor 8df9c854fa fix: Error imports that have nothing to import (#14577)
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.
2026-11-13 08:33:36 -05:00

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);
});
});