Created
January 30, 2016 01:22
-
-
Save viceversus/4d1fedcee9a5728bb5ee to your computer and use it in GitHub Desktop.
User List Spec
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 React from 'react'; | |
import UserList from 'user_list'; | |
import { shallow } from 'enzyme'; | |
describe('UserList', function () { | |
var set, onSelectSpy, wrapper, instance; | |
beforeEach(function () { | |
set = new Set(); | |
onSelectSpy = jasmine.createSpy('onSelect'); | |
wrapper = shallow(<UserList set={set} | |
onSelect={onSelectSpy}/>); | |
instance = wrapper.instance(); | |
}); | |
it('renders table as the root element', function () { | |
expect(wrapper.is('table')).toBeTruthy(); | |
}); | |
describe('some method where onSelect called at some point', function () { | |
it('calls the spy', function () { | |
instance.someMethod(); | |
expect(onSelectSpy).toHaveBeenCalledWith('foo'); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment