From 0420734d9793403a6a119e9d48bdd32b0e9270ed Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 13 Mar 2024 16:48:32 +0100 Subject: [PATCH] Add failing test --- .../rowProcessor/tests/attachments.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts b/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts index 43af79d82c..beea04829b 100644 --- a/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts +++ b/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts @@ -115,4 +115,17 @@ describe("attachment cleanup", () => { await AttachmentCleanup.rowUpdate(table(), { row: row(), oldRow: row() }) expect(mockedDeleteFiles).not.toBeCalled() }) + + it("should be able to cleanup a column and not throw when attachments are undefined", async () => { + const originalTable = table() + delete originalTable.schema["attach"] + await AttachmentCleanup.tableUpdate( + originalTable, + [{ attach: undefined }], + { + oldTable: table(), + } + ) + expect(mockedDeleteFiles).not.toBeCalled() + }) })