@@ -154,7 +146,6 @@ const VideoDetailPage = () => {
{courseMetadata?.title}
@@ -242,7 +233,6 @@ const VideoDetailPage = () => {
a: (chunks) => (
{chunks}
@@ -255,7 +245,6 @@ const VideoDetailPage = () => {
variant="primary"
as={Hyperlink}
destination={`/${enterpriseCustomer.slug}/course/${courseMetadata?.key}`}
- target="_blank"
className="mt-4.5 w-100"
>
({
useRedeemablePolicies: jest.fn(() => ({ data: { redeemablePolicies: [] } })),
useVideoCourseMetadata: jest.fn(() => ({ data: { courseKey: 'test-course-key' } })),
useVideoCourseReviews: jest.fn(() => ({ data: { courseKey: 'test-course-key' } })),
+ useSubscriptions: jest.fn(),
}));
jest.mock('react-router-dom', () => ({
@@ -97,6 +101,18 @@ describe('VideoDetailPage Tests', () => {
useEnterpriseCustomer.mockReturnValue({ data: mockEnterpriseCustomer });
useVideoDetails.mockReturnValue({ data: VIDEO_MOCK_DATA });
useVideoCourseReviews.mockReturnValue({ data: mockCourseReviews });
+ useSubscriptions.mockReturnValue({
+ data: {
+ subscriptionLicense: {
+ status: LICENSE_STATUS.ACTIVATED,
+ subscriptionPlan: {
+ enterpriseCatalogUuid: 'test-catalog-uuid',
+ isCurrent: true,
+ },
+ },
+ },
+ });
+ features.FEATURE_ENABLE_VIDEO_CATALOG = true;
});
it('Renders video details when data is available', () => {
@@ -135,4 +151,19 @@ describe('VideoDetailPage Tests', () => {
renderWithRouter();
expect(screen.getByTestId('not-found-page')).toBeInTheDocument();
});
+ it('renders a not found page when user do not have active subscription', () => {
+ useSubscriptions.mockReturnValue({
+ data: {
+ subscriptionLicense: {
+ status: LICENSE_STATUS.ACTIVATED,
+ subscriptionPlan: {
+ enterpriseCatalogUuid: 'test-catalog-uuid',
+ isCurrent: false,
+ },
+ },
+ },
+ });
+ renderWithRouter();
+ expect(screen.getByTestId('not-found-page')).toBeInTheDocument();
+ });
});