-
-
Notifications
You must be signed in to change notification settings - Fork 367
Expand file tree
/
Copy pathdomain-aggregate-status.unit.test.ts
More file actions
35 lines (32 loc) · 1.03 KB
/
domain-aggregate-status.unit.test.ts
File metadata and controls
35 lines (32 loc) · 1.03 KB
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
import { describe, expect, it } from "vitest";
import { DomainStatus } from "@prisma/client";
import { aggregateDomainStatus } from "~/lib/domain-aggregate-status";
describe("aggregateDomainStatus", () => {
it("returns SUCCESS only when identity, DKIM, and SPF are all SUCCESS", () => {
expect(
aggregateDomainStatus({
status: DomainStatus.SUCCESS,
dkimStatus: DomainStatus.SUCCESS,
spfDetails: DomainStatus.SUCCESS,
}),
).toBe(DomainStatus.SUCCESS);
});
it("returns the worst status across the three checks", () => {
expect(
aggregateDomainStatus({
status: DomainStatus.SUCCESS,
dkimStatus: DomainStatus.SUCCESS,
spfDetails: DomainStatus.PENDING,
}),
).toBe(DomainStatus.PENDING);
});
it("treats FAILED as worse than PENDING", () => {
expect(
aggregateDomainStatus({
status: DomainStatus.SUCCESS,
dkimStatus: DomainStatus.FAILED,
spfDetails: DomainStatus.PENDING,
}),
).toBe(DomainStatus.FAILED);
});
});