Created
April 11, 2019 19:37
-
-
Save adrian-afergon/d9f32c2311c8ebb334fcf886f4cc17d6 to your computer and use it in GitHub Desktop.
This is an example of a not readable test
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
import { shallow } from 'enzyme'; | |
import * as React from 'react'; | |
import { ExerciseDetail } from './'; | |
describe('ExerciseDetail', () => { | |
it('should display the warning', () => { | |
const anExercise: Exercise = { | |
warning: 'irrelevant warning message', | |
tags: ['irrelevant tag', 'irrelevant tag'], | |
name: 'irrelevant name', | |
image: 'irrelevant image url' | |
// ... at less 20 props | |
} | |
const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>); | |
const message = wrapper.find('Message'); | |
expect(message.exists()).toBeTruthy(); | |
}); | |
it('should not display the warning', () => { | |
const anExercise: Exercise = { | |
warning: 'irrelevant warning message', | |
tags: ['irrelevant tag', 'irrelevant tag'], | |
name: 'irrelevant name', | |
image: 'irrelevant image url' | |
// ... at less 20 props | |
} | |
const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>); | |
const message = wrapper.find('Message'); | |
expect(message.exists()).toBeFalsy(); | |
}); | |
it('should render a list of 2 tags', () => { | |
const anExercise: Exercise = { | |
warning: 'irrelevant warning message', | |
tags: ['irrelevant tag', 'irrelevant tag'], | |
name: 'irrelevant name', | |
image: 'irrelevant image url' | |
// ... at less 20 props | |
} | |
const wrapper = shallow(<ExerciseDetail exercise={anExercise}/>); | |
const chips = wrapper.find('Chip'); | |
expect(chips.length).toBe(2); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment