feat(studio): recover matching Nitro sources and persist import phases
This commit is contained in:
@@ -221,7 +221,7 @@ it("does not save a translated outcome after ownership is lost during translatio
|
||||
});
|
||||
await drainFurnitureImports();
|
||||
expect(mocks.translate).toHaveBeenCalledOnce();
|
||||
expect(snapshots).toHaveLength(2);
|
||||
expect(snapshots).toHaveLength(3);
|
||||
expect(snapshots.at(-1)?.items[0].state).toBe("running");
|
||||
expect(mocks.updateCatalog).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -249,3 +249,16 @@ it("keeps successful imports complete if their audit write fails", async () => {
|
||||
expect(job.items[0].state).toBe("done");
|
||||
expect(job.items[0].warnings).toContain("Audit record could not be saved");
|
||||
});
|
||||
|
||||
it("persists progress before continuing an import and retains the failed phase", async () => {
|
||||
mocks.import.mockImplementationOnce(async (params) => {
|
||||
await params.onProgress("downloading");
|
||||
expect(job.items[0].phase).toBe("downloading");
|
||||
expect(mocks.save).toHaveBeenCalled();
|
||||
await params.onProgress("converting");
|
||||
throw Error("Conversion failed");
|
||||
});
|
||||
await drainFurnitureImports();
|
||||
expect(job.items[0]).toMatchObject({ state: "failed", phase: "converting" });
|
||||
expect(job.items[0].phaseStartedAt).toBeTruthy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user