vue-instantsearch
Version:
👀 Lightning-fast Algolia search for Vue apps
40 lines (34 loc) • 923 B
JavaScript
/**
* @jest-environment jsdom
*/
import { mount } from '../../../test/utils';
import { __setState } from '../../mixins/widget';
import QueryRuleContext from '../QueryRuleContext';
import '../../../test/utils/sortedHtmlSerializer';
jest.mock('../../mixins/widget');
it('is renderless', () => {
__setState({
items: ["this isn't used"],
});
const wrapper = mount(QueryRuleContext, {
propsData: {
trackedFilters: {},
},
});
expect(wrapper.text()).toMatchInlineSnapshot(`""`);
});
it('accepts only trackedFilters and transformRuleContexts', () => {
const trackedFilters = {};
const transformRuleContexts = jest.fn();
const wrapper = mount(QueryRuleContext, {
propsData: {
trackedFilters,
transformRuleContexts,
transformItems: "won't be transferred",
},
});
expect(wrapper.vm.widgetParams).toEqual({
trackedFilters,
transformRuleContexts,
});
});