Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Created September 15, 2016 20:30
Show Gist options
  • Select an option

  • Save KensoDev/222524c0c858a69fafcac290c4e47734 to your computer and use it in GitHub Desktop.

Select an option

Save KensoDev/222524c0c858a69fafcac290c4e47734 to your computer and use it in GitHub Desktop.
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