Improve buildAttachment construction in tests

This commit is contained in:
Tom Moor
2024-08-01 22:01:49 +01:00
parent bf7fb8aa68
commit cd04c4a8bf
2 changed files with 4 additions and 2 deletions

View File

@@ -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({

View File

@@ -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,