-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show video section to learners with active subscription (#1140)
Co-authored-by: Maham Akif <[email protected]>
- Loading branch information
1 parent
beeacc8
commit 758578a
Showing
4 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
"dependencies": { | ||
"@edx/brand": "npm:@openedx/[email protected]", | ||
"@edx/frontend-component-footer": "13.0.2", | ||
"@edx/frontend-enterprise-catalog-search": "10.5.0", | ||
"@edx/frontend-enterprise-catalog-search": "10.6.0", | ||
"@edx/frontend-enterprise-hotjar": "6.0.0", | ||
"@edx/frontend-enterprise-logistration": "8.0.0", | ||
"@edx/frontend-enterprise-utils": "8.0.0", | ||
|
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import { screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import { AppContext } from '@edx/frontend-platform/react'; | ||
import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { useSubscriptions } from '../../app/data'; | ||
import { LICENSE_STATUS } from '../../enterprise-user-subsidy/data/constants'; | ||
import SearchPage from '../SearchPage'; | ||
import { features } from '../../../config'; | ||
import { renderWithRouter } from '../../../utils/tests'; | ||
|
||
jest.mock('../../app/data', () => ({ | ||
useSubscriptions: jest.fn(), | ||
})); | ||
|
||
jest.mock('../utils', () => ({ | ||
getSearchFacetFilters: jest.fn().mockReturnValue([]), | ||
})); | ||
|
||
jest.mock('../Search', () => function () { | ||
return <div>Mock Search Component</div>; | ||
}); | ||
|
||
const initialAppState = { | ||
authenticatedUser: { userId: 'test-user-id', username: 'test-username' }, | ||
}; | ||
|
||
const renderSearchPage = () => renderWithRouter( | ||
<IntlProvider locale="en"> | ||
<AppContext.Provider value={initialAppState}> | ||
<SearchPage /> | ||
</AppContext.Provider> | ||
</IntlProvider>, | ||
); | ||
|
||
describe('SearchPage', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
features.FEATURE_ENABLE_VIDEO_CATALOG = true; | ||
}); | ||
|
||
it('renders SearchPage component', () => { | ||
useSubscriptions.mockReturnValue({ | ||
data: { | ||
subscriptionLicense: { | ||
status: LICENSE_STATUS.ACTIVATED, | ||
subscriptionPlan: { isCurrent: true }, | ||
}, | ||
}, | ||
}); | ||
|
||
renderSearchPage(); | ||
expect(screen.queryByText('Mock Search Component')).toBeInTheDocument(); | ||
}); | ||
}); |