Last active
July 7, 2016 06:19
-
-
Save hartzis/d9c5f448eecdf3475d48 to your computer and use it in GitHub Desktop.
Enzyme Tape React Tests example List
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 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