Skip to content

Instantly share code, notes, and snippets.

@viceversus
Created January 30, 2016 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viceversus/4d1fedcee9a5728bb5ee to your computer and use it in GitHub Desktop.
Save viceversus/4d1fedcee9a5728bb5ee to your computer and use it in GitHub Desktop.
User List Spec
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