-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dynamic button text and subtitle fix (#1243)
* fix: dynamic button text * fix: subtitle changes * fix: PR requests * fix: quick fix
- Loading branch information
Showing
7 changed files
with
97 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import { | |
useEnterpriseCustomer, | ||
useEnterpriseGroup, | ||
useEnterpriseGroupLearners, | ||
useEnterpriseRemovedGroupMembers, | ||
useEnterpriseOffer, | ||
useIsLargeOrGreater, | ||
useSubsidyAccessPolicy, | ||
|
@@ -66,6 +67,7 @@ jest.mock('../data', () => ({ | |
useEnterpriseGroup: jest.fn(), | ||
useEnterpriseGroupLearners: jest.fn(), | ||
useEnterpriseGroupMembersTableData: jest.fn(), | ||
useEnterpriseRemovedGroupMembers: jest.fn(), | ||
useEnterpriseOffer: jest.fn(), | ||
useIsLargeOrGreater: jest.fn().mockReturnValue(true), | ||
useSubsidyAccessPolicy: jest.fn(), | ||
|
@@ -453,6 +455,10 @@ describe('<BudgetDetailPage />', () => { | |
budgetRedemptions: mockEmptyBudgetRedemptions, | ||
fetchBudgetRedemptions: jest.fn(), | ||
}); | ||
useEnterpriseRemovedGroupMembers.mockReturnValue({ | ||
isRemovedMembersLoading: false, | ||
removedGroupMembersCount: 0, | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper />); | ||
|
||
if (isLoading) { | ||
|
@@ -648,12 +654,63 @@ describe('<BudgetDetailPage />', () => { | |
budgetRedemptions: mockEmptyBudgetRedemptions, | ||
fetchBudgetRedemptions: jest.fn(), | ||
}); | ||
useEnterpriseRemovedGroupMembers.mockReturnValue({ | ||
isRemovedMembersLoading: false, | ||
removedGroupMembersCount: 0, | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper />); | ||
|
||
// Overview empty state (no content assignments, no spent transactions) | ||
expect(screen.getByText('No budget activity yet? Invite members to browse the catalog and enroll!')).toBeInTheDocument(); | ||
const illustrationTestIds = ['name-your-members-illustration', 'members-browse-illustration', 'enroll-and-spend-illustration']; | ||
illustrationTestIds.forEach(testId => expect(screen.getByTestId(testId)).toBeInTheDocument()); | ||
expect(screen.getByText('Get started', { selector: 'a' })).toBeInTheDocument(); | ||
}); | ||
|
||
it('still render bne zero state if there are members but no spend', async () => { | ||
useParams.mockReturnValue({ | ||
enterpriseSlug: 'test-enterprise-slug', | ||
enterpriseAppPage: 'test-enterprise-page', | ||
budgetId: 'a52e6548-649f-4576-b73f-c5c2bee25e9c', | ||
activeTabKey: 'activity', | ||
}); | ||
useSubsidyAccessPolicy.mockReturnValue({ | ||
isInitialLoading: false, | ||
data: mockPerLearnerSpendLimitSubsidyAccessPolicy, | ||
}); | ||
useEnterpriseGroupLearners.mockReturnValue({ | ||
data: { | ||
count: 1, | ||
currentPage: 1, | ||
next: null, | ||
numPages: 1, | ||
results: { | ||
enterpriseGroupMembershipUuid: 'cde2e374-032f-4c08-8c0d-bf3205fa7c7e', | ||
learnerId: 4382, | ||
memberDetails: { userEmail: '[email protected]', userName: 'ayy lmao' }, | ||
}, | ||
}, | ||
}); | ||
useEnterpriseRemovedGroupMembers.mockReturnValue({ | ||
isRemovedMembersLoading: false, | ||
removedGroupMembersCount: 0, | ||
}); | ||
useBudgetDetailActivityOverview.mockReturnValue({ | ||
isLoading: false, | ||
data: mockEmptyStateBudgetDetailActivityOverview, | ||
}); | ||
useBudgetRedemptions.mockReturnValue({ | ||
isLoading: false, | ||
budgetRedemptions: mockEmptyBudgetRedemptions, | ||
fetchBudgetRedemptions: jest.fn(), | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper />); | ||
|
||
// Overview empty state (no content assignments, no spent transactions) | ||
screen.debug(undefined, 1000000); | ||
|
||
expect(screen.queryByText('No budget activity yet? Invite members to browse the catalog and enroll!')).toBeInTheDocument(); | ||
|
||
expect(screen.getByText('Invite more members', { selector: 'a' })).toBeInTheDocument(); | ||
}); | ||
|
||
|
@@ -1548,6 +1605,10 @@ describe('<BudgetDetailPage />', () => { | |
budgetRedemptions: mockEmptyBudgetRedemptions, | ||
fetchBudgetRedemptions: jest.fn(), | ||
}); | ||
useEnterpriseRemovedGroupMembers.mockReturnValue({ | ||
isRemovedMembersLoading: false, | ||
removedGroupMembersCount: 0, | ||
}); | ||
renderWithRouter(<BudgetDetailPageWrapper />); | ||
|
||
// Catalog tab does NOT exist | ||
|
@@ -2228,6 +2289,10 @@ describe('<BudgetDetailPage />', () => { | |
}, | ||
}, | ||
}); | ||
useEnterpriseRemovedGroupMembers.mockReturnValue({ | ||
isRemovedMembersLoading: false, | ||
removedGroupMembersCount: 0, | ||
}); | ||
renderWithRouter( | ||
<BudgetDetailPageWrapper | ||
initialState={initialState} | ||
|