File size: 1,024 Bytes
c09f67c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { expect, test } from "bun:test";
import { getAllowedAttachments, getDomainFromEmail } from "./utils";

test("Get domain from email", () => {
  expect(getDomainFromEmail("invoice@supabase.com")).toMatch("supabase.com");
});

test("Should return 2 allowed attachments", () => {
  expect(
    getAllowedAttachments([
      {
        ContentLength: 51899,
        Name: "DigitalOcean Invoice 2023 Apr (33-11).pdf",
        ContentType: "application/pdf",
        ContentID: "",
        Content: "",
      },
      {
        ContentLength: 51899,
        Name: "Photo.jpg",
        ContentType: "image/jpeg",
        ContentID: "",
        Content: "",
      },
      {
        ContentLength: 673,
        Name: "ergerwed",
        ContentType: "application/pgp-keys",
        ContentID: "",
        Content: "",
      },
      {
        ContentLength: 249,
        Name: "wedwed",
        ContentType: "application/pgp-signature",
        ContentID: "",
        Content: "",
      },
    ]),
  ).toBeArrayOfSize(2);
});