Created
March 6, 2020 03:29
-
-
Save rodoabad/dbc4a8cce600113786af29881954a1d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 {CommentList} from '../CommentList'; | |
import React from 'react'; | |
import {shallow} from 'enzyme'; | |
describe('Given the <CommentList/> component', () => { | |
const requiredProps = () => ({}); | |
const render = (props = requiredProps()) => shallow(<CommentList {...props} />); | |
test('should render', () => { | |
const wrapper = render(); | |
expect(wrapper).toHaveLength(1); | |
}); | |
test('should show some text if there are no comments', () => { | |
const expectedText = 'No comments yet'; | |
const props = { | |
...requiredProps(), | |
comments: [] | |
}; | |
const wrapper = render(props); | |
expect(wrapper.text()).toStrictEqual(expectedText); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment