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.

Update index.test.ts

Kiran K7b7a0110d119
diff --git a/apps/web/tests/webhooks/index.test.ts b/apps/web/tests/webhooks/index.test.ts
index 9d195a0f74..4aac64a401 100644
--- a/apps/web/tests/webhooks/index.test.ts
+++ b/apps/web/tests/webhooks/index.test.ts
@@ -18,7 +18,10 @@ import {
partnerMergedWebhookSchema,
} from "@/lib/zod/schemas/partners";
import { payoutWebhookEventSchema } from "@/lib/zod/schemas/payouts";
-import { programApplicationWebhookSchema } from "@/lib/zod/schemas/program-application";
+import {
+ partnerApplicationWebhookSchema,
+ programApplicationWebhookSchema,
+} from "@/lib/zod/schemas/program-application";
import { describe, expect, test } from "vitest";
import * as z from "zod/v4";
@@ -90,6 +93,28 @@ const payoutWebhookEventSchemaExtended = payoutWebhookEventSchema.extend({
.transform((str) => (str ? new Date(str) : null)),
});
+const programApplicationWebhookSchemaExtended =
+ programApplicationWebhookSchema.extend({
+ partner: programApplicationWebhookSchema.shape.partner.extend({
+ payoutsEnabledAt: z
+ .string()
+ .transform((str) => (str ? new Date(str) : null))
+ .nullable(),
+ platforms: z
+ .array(
+ z.object({
+ type: z.string(),
+ identifier: z.string(),
+ verifiedAt: z
+ .string()
+ .transform((str) => (str ? new Date(str) : null))
+ .nullable(),
+ }),
+ )
+ .nullish(),
+ }),
+ });
+
const eventSchemas: Record<WebhookTrigger, z.ZodSchema> = {
"link.created": linkEventSchema,
"link.updated": linkEventSchema,
@@ -97,8 +122,8 @@ const eventSchemas: Record<WebhookTrigger, z.ZodSchema> = {
"link.clicked": clickWebhookEventSchema,
"lead.created": leadWebhookEventSchemaExtended,
"sale.created": saleWebhookEventSchemaExtended,
- "partner.application_submitted": programApplicationWebhookSchema,
- "program_application.created": programApplicationWebhookSchema,
+ "partner.application_submitted": partnerApplicationWebhookSchema,
+ "program_application.created": programApplicationWebhookSchemaExtended,
"partner.enrolled": enrolledPartnerSchemaExtended,
"partner.merged": partnerMergedWebhookSchema,
"commission.created": commissionWebhookEventSchemaExtended,