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.

Sort earnings numerically in the earnings e2e tests

Rafi8195637e571d
diff --git a/apps/web/playwright/api/embed/referrals-earnings.spec.ts b/apps/web/playwright/api/embed/referrals-earnings.spec.ts
index c792d89007..112f49f079 100644
--- a/apps/web/playwright/api/embed/referrals-earnings.spec.ts
+++ b/apps/web/playwright/api/embed/referrals-earnings.spec.ts
@@ -68,9 +68,9 @@ test("GET /embed/referrals/earnings - masks the customer email until data sharin
}>("/api/embed/referrals/earnings?withTotal=true");
expect(masked.status).toEqual(200);
expect(masked.data.total).toEqual(2);
- expect(masked.data.data.map((e) => e.earnings).sort()).toEqual([
- 1000, 2500,
- ]);
+ expect(
+ masked.data.data.map((e) => e.earnings).sort((a, b) => a - b),
+ ).toEqual([1000, 2500]);
for (const earning of masked.data.data) {
expect(earning.customer?.email).not.toEqual(email);
expect(earning.customer?.email).toContain("*");
diff --git a/apps/web/playwright/api/partner-profile/earnings.spec.ts b/apps/web/playwright/api/partner-profile/earnings.spec.ts
index 4e09329d48..9a09788408 100644
--- a/apps/web/playwright/api/partner-profile/earnings.spec.ts
+++ b/apps/web/playwright/api/partner-profile/earnings.spec.ts
@@ -112,7 +112,9 @@ test.describe("GET /partner-profile/earnings", () => {
);
expect(status).toEqual(200);
- expect(data.map((e) => e.earnings).sort()).toEqual([1000, 2500]);
+ expect(data.map((e) => e.earnings).sort((a, b) => a - b)).toEqual([
+ 1000, 2500,
+ ]);
for (const earning of data) {
expect(earning.program).toMatchObject({
id: program.id,