From 665218864ef3d971823ae137c3aff5b9d0b7619e Mon Sep 17 00:00:00 2001 From: Lael Birch Date: Mon, 8 Mar 2021 12:43:57 -0500 Subject: [PATCH] Add is_active to request querystring (#235) So that users only see valid coupons --- src/components/enterprise-user-subsidy/data/hooks.jsx | 1 + .../enterprise-user-subsidy/tests/UserSubsidy.test.jsx | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/enterprise-user-subsidy/data/hooks.jsx b/src/components/enterprise-user-subsidy/data/hooks.jsx index 9e1a60dcc8..5a61e13e9a 100644 --- a/src/components/enterprise-user-subsidy/data/hooks.jsx +++ b/src/components/enterprise-user-subsidy/data/hooks.jsx @@ -85,6 +85,7 @@ export function useOffers(enterpriseId) { fetchOffers({ enterprise_uuid: enterpriseId, full_discount_only: 'True', // Must be a string because the API does a string compare not a true JSON boolean compare. + is_active: 'True', }, dispatch); } diff --git a/src/components/enterprise-user-subsidy/tests/UserSubsidy.test.jsx b/src/components/enterprise-user-subsidy/tests/UserSubsidy.test.jsx index 280f237b55..2bf6fbbab3 100644 --- a/src/components/enterprise-user-subsidy/tests/UserSubsidy.test.jsx +++ b/src/components/enterprise-user-subsidy/tests/UserSubsidy.test.jsx @@ -139,6 +139,7 @@ describe('UserSubsidy', () => { expect(fetchOffers).toHaveBeenCalledWith({ enterprise_uuid: TEST_ENTERPRISE_UUID, full_discount_only: 'True', + is_active: 'True', }); await waitFor(() => { expect(screen.queryByText('Has access: false')).toBeInTheDocument(); @@ -172,6 +173,7 @@ describe('UserSubsidy', () => { expect(fetchOffers).toHaveBeenCalledWith({ enterprise_uuid: TEST_ENTERPRISE_UUID, full_discount_only: 'True', + is_active: 'True', }); await waitFor(() => { @@ -206,6 +208,7 @@ describe('UserSubsidy', () => { expect(fetchOffers).toHaveBeenCalledWith({ enterprise_uuid: TEST_ENTERPRISE_UUID, full_discount_only: 'True', + is_active: 'True', }); await waitFor(() => { @@ -238,7 +241,7 @@ describe('UserSubsidy', () => { expect(fetchEnterpriseCustomerSubscriptionPlan).toHaveBeenCalledWith(TEST_ENTERPRISE_UUID); expect(fetchSubscriptionLicensesForUser).toHaveBeenCalledWith(TEST_ENTERPRISE_UUID); expect(fetchOffers).toHaveBeenCalledTimes(1); - expect(fetchOffers).toHaveBeenCalledWith({ enterprise_uuid: TEST_ENTERPRISE_UUID, full_discount_only: 'True' }); + expect(fetchOffers).toHaveBeenCalledWith({ enterprise_uuid: TEST_ENTERPRISE_UUID, full_discount_only: 'True', is_active: 'True' }); await waitFor(() => { expect(screen.queryByText('Offers count: 0')).toBeInTheDocument();