Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import { shallow } from 'enzyme';
  2. import * as React from 'react';
  3. import { ExerciseDetail } from './';
  4. import { createAnExercise } from './ExerciseMockBuilder'
  5.  
  6. describe('ExerciseDetail', () => {
  7. it('should display the warning when it\'s present in the exercise', () => {
  8. const anExercise: Exercise = createAnExercise({warning: 'a warning message'})
  9. const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>);
  10. const message = wrapper.find('Message');
  11.  
  12. expect(message.exists()).toBeTruthy();
  13. });
  14.  
  15. it('should not display the warning when it\'s not set in the exercise', () => {
  16. const anExercise: Exercise = createAnExercise({warning: null})
  17. const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>);
  18. const message = wrapper.find('Message');
  19.  
  20. expect(message.exists()).toBeFalsy();
  21. });
  22.  
  23. it('should render a list multiple tags', () => {
  24. const someTags = ['irrelevant tag 1', 'irrelevant tag 2']
  25. const anExercise: Exercise = createAnExercise({tags: someTags})
  26. const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>);
  27. const chips = wrapper.find('Chip');
  28.  
  29. expect(chips.length).toBe(someTags.length);
  30. });
  31.  
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement