Skip to content

Commit

Permalink
Add is_active to request querystring (#235)
Browse files Browse the repository at this point in the history
So that users only see valid coupons
  • Loading branch information
Lael Birch committed Mar 8, 2021
1 parent c302f00 commit 6652188
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/enterprise-user-subsidy/data/hooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -172,6 +173,7 @@ describe('UserSubsidy', () => {
expect(fetchOffers).toHaveBeenCalledWith({
enterprise_uuid: TEST_ENTERPRISE_UUID,
full_discount_only: 'True',
is_active: 'True',
});

await waitFor(() => {
Expand Down Expand Up @@ -206,6 +208,7 @@ describe('UserSubsidy', () => {
expect(fetchOffers).toHaveBeenCalledWith({
enterprise_uuid: TEST_ENTERPRISE_UUID,
full_discount_only: 'True',
is_active: 'True',
});

await waitFor(() => {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 6652188

Please sign in to comment.