Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { RestApi } from '@magento/peregrine';
import { dispatch, getState } from '../../../store';
import actions from '../actions';
import { getCountries } from '../asyncActions';
jest.mock('../../../store');
const thunkArgs = [dispatch, getState];
const { request } = RestApi.Magento2;
afterEach(() => {
dispatch.mockClear();
request.mockClear();
});
test('getCountries() to return a thunk', () => {
expect(getCountries()).toBeInstanceOf(Function);
});
test('getCountries thunk returns undefined', async () => {
const thunk = getCountries();
await expect(thunk(...thunkArgs)).resolves.toBeUndefined();
});