Skip to content

Commit

Permalink
test(toggleRefinement): mutate helper state before dispose test
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Jul 29, 2019
1 parent 6834fd6 commit 05fc478
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,18 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/toggle-refi
const render = jest.fn();
const makeWidget = connectToggleRefinement(render);
const indexName = 'indexName';
const helper = jsHelper({}, indexName, {});
const helper = jsHelper({}, indexName, {
disjunctiveFacets: ['freeShipping'],
});
helper.search = jest.fn();

const attribute = 'freeShipping';
const widget = makeWidget({
attribute,
});

helper.addDisjunctiveFacetRefinement('freeShipping', ['true']);

This comment has been minimized.

Copy link
@samouss

samouss Jul 29, 2019

Contributor

We could have inlined the two inside the Helper definition.


const nextState = widget.dispose({ state: helper.state });

expect(nextState).toEqual(
Expand Down

0 comments on commit 05fc478

Please sign in to comment.