Skip to content

Commit

Permalink
chore(test): update MenuSelect test to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Jun 11, 2021
1 parent 7147b4b commit fba665d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { h } from 'preact';
import MenuSelect from '../MenuSelect';
import { mount } from 'enzyme';
import defaultTemplates from '../../../widgets/menu-select/defaultTemplates';
import { ReactElementLike } from 'prop-types';

describe('MenuSelect', () => {
const cssClasses = {
Expand All @@ -16,15 +17,15 @@ describe('MenuSelect', () => {
it('should render <MenuSelect /> with items', () => {
const props = {
items: [
{ value: 'foo', label: 'foo' },
{ value: 'bar', label: 'bar' },
{ value: 'foo', label: 'foo', count: 0, isRefined: false },
{ value: 'bar', label: 'bar', count: 0, isRefined: false },
],
refine: () => {},
templateProps: { templates: defaultTemplates },
cssClasses,
};

const wrapper = mount(<MenuSelect {...props} />);
const wrapper = mount((<MenuSelect {...props} />) as ReactElementLike);

expect(wrapper).toMatchSnapshot();
});
Expand All @@ -37,16 +38,16 @@ describe('MenuSelect', () => {
cssClasses,
};

const wrapper = mount(<MenuSelect {...props} />);
const wrapper = mount((<MenuSelect {...props} />) as ReactElementLike);

expect(wrapper).toMatchSnapshot();
});

it('should render <MenuSelect /> with custom templates', () => {
const props = {
items: [
{ value: 'foo', label: 'foo' },
{ value: 'bar', label: 'bar' },
{ value: 'foo', label: 'foo', count: 0, isRefined: false },
{ value: 'bar', label: 'bar', count: 0, isRefined: false },
],
refine: () => {},
templateProps: {
Expand All @@ -58,7 +59,7 @@ describe('MenuSelect', () => {
cssClasses,
};

const wrapper = mount(<MenuSelect {...props} />);
const wrapper = mount((<MenuSelect {...props} />) as ReactElementLike);

expect(wrapper).toMatchSnapshot();
});
Expand Down

0 comments on commit fba665d

Please sign in to comment.