Skip to content

Instantly share code, notes, and snippets.

@nucab
Created August 27, 2020 17:22
Show Gist options
  • Save nucab/edd44dd4a5bc226c2aa924cd37090e33 to your computer and use it in GitHub Desktop.
Save nucab/edd44dd4a5bc226c2aa924cd37090e33 to your computer and use it in GitHub Desktop.
jest.mock('antd', () => {
const antd = jest.requireActual('antd');
const Select = ({ children, onChange }: any) => (
<select
data-testid="entries-select"
onChange={e => onChange(e.target.value)}
>
{children}
</select>
);
Select.Option = ({ children, ...otherProps }: any) => (
<option
data-testid={`${children![0].toString()}-entries`}
{...otherProps}
>{`${children![0].toString()} Entries`}</option>
);
return {
...antd,
Select,
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment