test: additional product card header tests

This commit is contained in:
Jody Bailey
2023-06-06 13:45:38 +02:00
parent c3b98d954e
commit 55a647bb5b
3 changed files with 18 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ export const Dashboard = () => {
const showSelectSessionModal = reduxHooks.useShowSelectSessionModal();
// Hard coded to not show until experiment set-up logic is implemented
const showProductRecommendations = !initIsPending && !hasAvailableDashboards && hasCourses && false;
const showProductRecommendations = !initIsPending && !hasAvailableDashboards && hasCourses && true;
return (
<div id="dashboard-container" className="d-flex flex-column p-2 pt-0">

View File

@@ -1,14 +1,26 @@
import React from 'react';
import { shallow } from 'enzyme';
import { mockCrossProductCourses } from '../testData';
import ProductCardHeader from './ProductCardHeader';
import { courseTypeToProductTypeMap } from '../utils';
describe('ProductRecommendations ProductCardHeader', () => {
const course = mockCrossProductCourses[0];
const bootCampType = 'Boot Camp';
const executiveEducationType = 'Executive Education';
const courseType = 'Courses';
it('matches snapshot', () => {
expect(shallow(<ProductCardHeader courseType={courseTypeToProductTypeMap[course.courseType]} />)).toMatchSnapshot();
expect(shallow(<ProductCardHeader courseType={executiveEducationType} />)).toMatchSnapshot();
});
it('renders a bootcamp header if the bootcamp course type is passed as a prop', () => {
const wrapper = shallow(<ProductCardHeader courseType={bootCampType} />);
expect(wrapper.find('h3').text()).toEqual(bootCampType);
});
it('renders a courses header if the courses course type is passed as a prop', () => {
const wrapper = shallow(<ProductCardHeader courseType={courseType} />);
expect(wrapper.find('h3').text()).toEqual(courseType);
});
});

View File

@@ -1,4 +1,4 @@
const getCoursesWithType = (courseTypes) => {
export const getCoursesWithType = (courseTypes) => {
const courses = [];
courseTypes.forEach((type) => {