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 the tests

Kiran Kf4eb19b95f8c
diff --git a/apps/web/lib/webhook/sample-events/partner-created.json b/apps/web/lib/webhook/sample-events/partner-created.json
index 9947d4c436..6b433c1602 100644
--- a/apps/web/lib/webhook/sample-events/partner-created.json
+++ b/apps/web/lib/webhook/sample-events/partner-created.json
@@ -1,18 +1,13 @@
{
- "id": "evt_77QXrD9J1hfu1wyLKzfTH6omZ",
- "event": "partner.created",
- "createdAt": "2025-02-06T17:16:00.021Z",
- "data": {
- "id": "pn_BlBxRjQW7pC2MreIvtCcCROr",
- "name": "Matthew Hayden",
- "email": "[email protected]",
- "image": null,
- "country": "US",
- "bio": "I'm a content creator who works with brands to grow their business.",
- "status": "approved",
- "stripeConnectId": null,
- "payoutsEnabled": false,
- "createdAt": "2025-02-06T17:15:59.658Z",
- "updatedAt": "2025-02-06T17:15:59.658Z"
- }
+ "id": "pn_BlBxRjQW7pC2MreIvtCcCROr",
+ "name": "Matthew Hayden",
+ "email": "[email protected]",
+ "image": null,
+ "country": "US",
+ "bio": "I'm a content creator who works with brands to grow their business.",
+ "status": "default",
+ "stripeConnectId": null,
+ "payoutsEnabled": false,
+ "createdAt": "2025-02-06T17:15:59.658Z",
+ "updatedAt": "2025-02-06T17:15:59.658Z"
}
diff --git a/apps/web/tests/webhooks/index.test.ts b/apps/web/tests/webhooks/index.test.ts
index cb599637fa..6d43c2bf0e 100644
--- a/apps/web/tests/webhooks/index.test.ts
+++ b/apps/web/tests/webhooks/index.test.ts
@@ -33,6 +33,11 @@ const saleWebhookEventSchemaExtended = saleWebhookEventSchema.extend({
customer: customerSchemaExtended,
});
+const partnerWebhookEventSchemaExtended = PartnerSchema.extend({
+ createdAt: z.string().transform((str) => new Date(str)),
+ updatedAt: z.string().transform((str) => new Date(str)),
+});
+
const eventSchemas: Record<WebhookTrigger, z.ZodSchema> = {
"link.created": linkEventSchema,
"link.updated": linkEventSchema,
@@ -40,7 +45,7 @@ const eventSchemas: Record<WebhookTrigger, z.ZodSchema> = {
"link.clicked": clickWebhookEventSchema,
"lead.created": leadWebhookEventSchemaExtended,
"sale.created": saleWebhookEventSchemaExtended,
- "partner.created": PartnerSchema,
+ "partner.created": partnerWebhookEventSchemaExtended,
};
describe("Webhooks", () => {