Skip to content

Instantly share code, notes, and snippets.

@hartzis
Last active July 7, 2016 06:19
Show Gist options
  • Save hartzis/d9c5f448eecdf3475d48 to your computer and use it in GitHub Desktop.
Save hartzis/d9c5f448eecdf3475d48 to your computer and use it in GitHub Desktop.
Enzyme Tape React Tests example List
import test from 'tape';
import React from 'react';
import { shallow } from 'enzyme';
import List from './List';
test('empty <List/>', (t)=> {
t.plan(1);
const emptyList = [];
const wrapper = shallow(<List items={emptyList} />);
t.equal(wrapper.find('span').text(), '0');
});
test('3 item <List/>', (t)=> {
t.plan(1);
const threeItemList = [{id:'one'}, {id:'two'}, {id:'three'}];
const wrapper = shallow(<List items={threeItemList} />);
t.equal(wrapper.find('Item').length, 3);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment