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.

Test that includeRewardsDiscounts=false leaves out the rewards

Rafi8dee2d3c5481
diff --git a/apps/web/playwright/api/partner-profile/programs.spec.ts b/apps/web/playwright/api/partner-profile/programs.spec.ts
index 3a354692e0..a736b18e42 100644
--- a/apps/web/playwright/api/partner-profile/programs.spec.ts
+++ b/apps/web/playwright/api/partner-profile/programs.spec.ts
@@ -189,6 +189,29 @@ test.describe("GET /partner-profile/programs", () => {
});
});
+ test("reads includeRewardsDiscounts=false as false", async ({
+ playwright,
+ }) => {
+ await withPartnerApi(playwright, async (partnerApi) => {
+ const path = `/api/partner-profile/programs?search=${suffix}`;
+
+ const { data: withRewards } = await partnerApi.get<
+ Record<string, unknown>[]
+ >(`${path}&includeRewardsDiscounts=true`);
+ const { data: withoutRewards } = await partnerApi.get<
+ Record<string, unknown>[]
+ >(`${path}&includeRewardsDiscounts=false`);
+ const { status } = await partnerApi.get(
+ `${path}&includeRewardsDiscounts=yes`,
+ );
+
+ // the discount is in the response only when the API includes it
+ expect(withRewards.every((e) => "discount" in e)).toBe(true);
+ expect(withoutRewards.some((e) => "discount" in e)).toBe(false);
+ expect(status).toEqual(422);
+ });
+ });
+
test("rejects an unknown status", async ({ playwright }) => {
await withPartnerApi(playwright, async (partnerApi) => {
const { status } = await partnerApi.get(