Created
September 15, 2016 20:30
-
-
Save KensoDev/222524c0c858a69fafcac290c4e47734 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 TopTribes from './index'; | |
| import TopTribeItem from './TopTribeItem'; | |
| import { shallow, mount } from 'enzyme'; | |
| describe('TopTribes', () => { | |
| it('renders nothing if there are no tribes', function() { | |
| var props = { | |
| top_tribes: [] | |
| }; | |
| const element = shallow(<TopTribes { ...props } />); | |
| expect(element.find(".topTribesComponent")).to.have.length(0); | |
| }); | |
| it('only renders 4 items even when there are more', () => { | |
| var props = { | |
| top_tribes: [ | |
| { id: 1 }, | |
| { id: 2 }, | |
| { id: 3 }, | |
| { id: 4 }, | |
| { id: 5 }, | |
| { id: 6 } | |
| ] | |
| }; | |
| const element = shallow(<TopTribes { ...props } />); | |
| expect(element.find(TopTribeItem)).to.have.length(4); | |
| }); | |
| it('renders 2 with no error when there are 2', function() { | |
| var props = { | |
| top_tribes: [ | |
| { id: 1 }, | |
| { id: 2 } | |
| ] | |
| }; | |
| const element = shallow(<TopTribes { ...props } />); | |
| expect(element.find(TopTribeItem)).to.have.length(2); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment