Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { shallow } from 'enzyme';
- import * as React from 'react';
- import { ExerciseDetail } from './';
- import { createAnExercise } from './ExerciseMockBuilder'
- describe('ExerciseDetail', () => {
- it('should display the warning when it\'s present in the exercise', () => {
- const anExercise: Exercise = createAnExercise({warning: 'a warning message'})
- const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>);
- const message = wrapper.find('Message');
- expect(message.exists()).toBeTruthy();
- });
- it('should not display the warning when it\'s not set in the exercise', () => {
- const anExercise: Exercise = createAnExercise({warning: null})
- const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>);
- const message = wrapper.find('Message');
- expect(message.exists()).toBeFalsy();
- });
- it('should render a list multiple tags', () => {
- const someTags = ['irrelevant tag 1', 'irrelevant tag 2']
- const anExercise: Exercise = createAnExercise({tags: someTags})
- const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>);
- const chips = wrapper.find('Chip');
- expect(chips.length).toBe(someTags.length);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement