From cd04c4a8bf92a8c0f6350eb65d5142787fa6689f Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 1 Aug 2024 22:01:49 +0100 Subject: [PATCH] Improve buildAttachment construction in tests --- server/models/User.test.ts | 4 ++-- server/test/factories.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/models/User.test.ts b/server/models/User.test.ts index 80ab4bff10..38fa3b236f 100644 --- a/server/models/User.test.ts +++ b/server/models/User.test.ts @@ -18,13 +18,13 @@ describe("user model", () => { buildUser({ name: "www.google.com", }) - ).rejects.toThrowError(); + ).rejects.toThrow(); await expect( buildUser({ name: "My name https://malicious.com", }) - ).rejects.toThrowError(); + ).rejects.toThrow(); await expect( buildUser({ diff --git a/server/test/factories.ts b/server/test/factories.ts index 1d9a46e95a..94c4a9e3bf 100644 --- a/server/test/factories.ts +++ b/server/test/factories.ts @@ -495,10 +495,12 @@ export async function buildAttachment( const acl = overrides.acl || "public-read"; const name = fileName || faker.system.fileName(); return Attachment.create({ + id, key: AttachmentHelper.getKey({ acl, id, name, userId: overrides.userId }), contentType: "image/png", size: 100, acl, + name, createdAt: new Date("2018-01-02T00:00:00.000Z"), updatedAt: new Date("2018-01-02T00:00:00.000Z"), ...overrides,