Improve tests

This commit is contained in:
Adria Navarro 2024-03-13 16:54:39 +01:00
parent 940ff5acd2
commit 625c1dda9f
1 changed files with 15 additions and 1 deletions

View File

@ -121,7 +121,21 @@ describe("attachment cleanup", () => {
delete originalTable.schema["attach"]
await AttachmentCleanup.tableUpdate(
originalTable,
[{ attach: undefined }],
[row("file 1"), { attach: undefined }, row("file 2")],
{
oldTable: table(),
}
)
expect(mockedDeleteFiles).toBeCalledTimes(1)
expect(mockedDeleteFiles).toBeCalledWith(BUCKET, ["file 1", "file 2"])
})
it("should be able to cleanup a column and not throw when ALL attachments are undefined", async () => {
const originalTable = table()
delete originalTable.schema["attach"]
await AttachmentCleanup.tableUpdate(
originalTable,
[{}, { attach: undefined }],
{
oldTable: table(),
}