mirror of
https://github.com/apache/superset.git
synced 2024-09-18 19:49:37 -04:00
test: Clean up SelectAsyncControl test warnings (#22969)
This commit is contained in:
parent
b1296a195c
commit
f6c304437a
@ -65,17 +65,17 @@ beforeEach(() => {
|
|||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Should render', () => {
|
test('Should render', async () => {
|
||||||
const props = createProps();
|
const props = createProps();
|
||||||
render(<SelectAsyncControl {...props} />, { useRedux: true });
|
render(<SelectAsyncControl {...props} />, { useRedux: true });
|
||||||
expect(screen.getByTestId('select-test')).toBeInTheDocument();
|
expect(await screen.findByTestId('select-test')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Should send correct props to Select component - value props', () => {
|
test('Should send correct props to Select component - value props', async () => {
|
||||||
const props = createProps();
|
const props = createProps();
|
||||||
render(<SelectAsyncControl {...props} />, { useRedux: true });
|
render(<SelectAsyncControl {...props} />, { useRedux: true });
|
||||||
|
|
||||||
expect(screen.getByTestId('select-test')).toHaveAttribute(
|
expect(await screen.findByTestId('select-test')).toHaveAttribute(
|
||||||
'data-value',
|
'data-value',
|
||||||
JSON.stringify(props.value),
|
JSON.stringify(props.value),
|
||||||
);
|
);
|
||||||
@ -89,20 +89,20 @@ test('Should send correct props to Select component - value props', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Should send correct props to Select component - function onChange multi:true', () => {
|
test('Should send correct props to Select component - function onChange multi:true', async () => {
|
||||||
const props = createProps();
|
const props = createProps();
|
||||||
render(<SelectAsyncControl {...props} />, { useRedux: true });
|
render(<SelectAsyncControl {...props} />, { useRedux: true });
|
||||||
expect(props.onChange).toBeCalledTimes(0);
|
expect(props.onChange).toBeCalledTimes(0);
|
||||||
userEvent.click(screen.getByText('onChange'));
|
userEvent.click(await screen.findByText('onChange'));
|
||||||
expect(props.onChange).toBeCalledTimes(1);
|
expect(props.onChange).toBeCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Should send correct props to Select component - function onChange multi:false', () => {
|
test('Should send correct props to Select component - function onChange multi:false', async () => {
|
||||||
const props = createProps();
|
const props = createProps();
|
||||||
render(<SelectAsyncControl {...{ ...props, multi: false }} />, {
|
render(<SelectAsyncControl {...{ ...props, multi: false }} />, {
|
||||||
useRedux: true,
|
useRedux: true,
|
||||||
});
|
});
|
||||||
expect(props.onChange).toBeCalledTimes(0);
|
expect(props.onChange).toBeCalledTimes(0);
|
||||||
userEvent.click(screen.getByText('onChange'));
|
userEvent.click(await screen.findByText('onChange'));
|
||||||
expect(props.onChange).toBeCalledTimes(1);
|
expect(props.onChange).toBeCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user