Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const runQuery = jest.fn();
const setLoading = jest.fn();
runQuery.cancel = jest.fn();
const queryState = {
data: null,
error: null,
loading: false
};
const queryApi = {
resetState,
runQuery,
setLoading
};
useQuery.mockImplementation(() => [queryState, queryApi]);
test('renders correctly', () => {
const { root } = createTestInstance(
<form>
);
expect(root.findByProps({ className: 'root_hidden' })).toBeTruthy();
expect(root.findByProps({ className: 'message' })).toBeTruthy();
expect(root.findByProps({ className: 'suggestions' })).toBeTruthy();
});
test('resets query state if not visible', () => {
createTestInstance(
<form></form></form>