Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix tests

Steven Tey44e39dd30d82
diff --git a/apps/web/app/api/domains/route.ts b/apps/web/app/api/domains/route.ts
index d627e05c8b..0b9ad6ee87 100644
--- a/apps/web/app/api/domains/route.ts
+++ b/apps/web/app/api/domains/route.ts
@@ -58,7 +58,7 @@ export const GET = withWorkspace(
const response = domains.map((domain) => {
const { links, ...rest } = domain;
return {
- ...rest,
+ ...DomainSchema.parse(rest),
...(includeLink &&
links.length > 0 && {
link: transformLink({
diff --git a/apps/web/tests/domains/index.test.ts b/apps/web/tests/domains/index.test.ts
index a53f5e51d9..5213819442 100644
--- a/apps/web/tests/domains/index.test.ts
+++ b/apps/web/tests/domains/index.test.ts
@@ -21,7 +21,7 @@ const expectedDomain = {
expiredUrl: domainRecord.expiredUrl,
createdAt: expect.any(String),
updatedAt: expect.any(String),
- registeredDomain: expect.any(Object).or(null),
+ registeredDomain: null,
};
describe.sequential("/domains/**", async () => {
@@ -50,7 +50,7 @@ describe.sequential("/domains/**", async () => {
});
expect(status).toEqual(200);
- expect(domain).toStrictEqual({ ...expectedDomain, registeredDomain: null });
+ expect(domain).toStrictEqual(expectedDomain);
});
test("GET /domains", async () => {
@@ -60,7 +60,9 @@ describe.sequential("/domains/**", async () => {
});
expect(status).toEqual(200);
- expect(domains).toContainEqual(expectedDomain);
+ expect(
+ domains.map((d) => ({ ...d, registeredDomain: null })),
+ ).toContainEqual(expectedDomain);
});
test("POST /domains/{slug}/primary", { retry: 3 }, async () => {