test: silence expected clone-import rollback warning
The rollback case intentionally hits items_base insert failure; mock console.warn so deploy logs stay clean. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
fa40eebeed
commit
3bb96eb6f3
1 file changed
+5
@@ -139,6 +139,7 @@ describe("clone-import", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("rolls back: unlinks .nitro and icon, skips FurnitureData when items_base INSERT rejects", async () => {
|
it("rolls back: unlinks .nitro and icon, skips FurnitureData when items_base INSERT rejects", async () => {
|
||||||
|
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||||
downloadFile.mockReset();
|
downloadFile.mockReset();
|
||||||
downloadFile.mockResolvedValue({ ok: true, size: 200 });
|
downloadFile.mockResolvedValue({ ok: true, size: 200 });
|
||||||
fsUnlink.mockReset();
|
fsUnlink.mockReset();
|
||||||
@@ -153,6 +154,7 @@ describe("clone-import", () => {
|
|||||||
// items_base INSERT rejects.
|
// items_base INSERT rejects.
|
||||||
execRaw.mockRejectedValueOnce(new Error("Duplicate entry"));
|
execRaw.mockRejectedValueOnce(new Error("Duplicate entry"));
|
||||||
|
|
||||||
|
try {
|
||||||
const r = await cloneSingleFurni({
|
const r = await cloneSingleFurni({
|
||||||
source: SOURCE,
|
source: SOURCE,
|
||||||
entry: { ...ENTRY, itemType: "s" },
|
entry: { ...ENTRY, itemType: "s" },
|
||||||
@@ -171,5 +173,8 @@ describe("clone-import", () => {
|
|||||||
// (d) result must be ok === false.
|
// (d) result must be ok === false.
|
||||||
expect(r.ok).toBe(false);
|
expect(r.ok).toBe(false);
|
||||||
expect(r.error).toMatch(/items_base insert failed/);
|
expect(r.error).toMatch(/items_base insert failed/);
|
||||||
|
} finally {
|
||||||
|
warn.mockRestore();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user