Skip to content

Instantly share code, notes, and snippets.

@jasongaare
Created June 8, 2017 01:20
Show Gist options
  • Save jasongaare/fee048190fb3a9bf3a2ce2b4a966c04f to your computer and use it in GitHub Desktop.
Save jasongaare/fee048190fb3a9bf3a2ce2b4a966c04f to your computer and use it in GitHub Desktop.
import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import FilterBar from 'components/filter/FilterBar';
const sampleFilters = { ids: [1, 2] };
describe('Testing FilterBar', () => {
it('removeFilters removes filters as expected', () => {
const onFiltersChangeSpy = sinon.spy();
const render = shallow(
<FilterBar filters={sampleFilters} onFiltersChange={onFiltersChangeSpy} />
);
render.instance().removeFilter({ id: 1 });
render.instance().removeFilter({ id: 2 });
expect(onFiltersChangeSpy.args).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment