Reactjs 在其他异步操作测试中调用的异步操作

Reactjs 在其他异步操作测试中调用的异步操作,reactjs,testing,redux,Reactjs,Testing,Redux,我对包含对其他异步操作的调用的异步操作的测试有问题,我得到 TypeError:无法读取未定义的属性“then” 行动包括: export function fetchSettings() { return dispatch => { dispatch({ type: FETCH_SETTINGS, }); return getSettings('settings') .then(res

我对包含对其他异步操作的调用的异步操作的测试有问题,我得到

TypeError:无法读取未定义的属性“then”

行动包括:

export function fetchSettings() {
    return dispatch => {
        dispatch({
            type: FETCH_SETTINGS,
        });
        return getSettings('settings')
            .then(response => dispatch(fetchSettingsSuccess(response)))
            .catch(error => dispatch(fetchSettingsFailure(error)));
    };
}

function fetchSettingsSuccess(response) {
    return {
        type: FETCH_SETTINGS_SUCCESS,
        response,
    };
}

export function disconnectAccount(account) {
    return dispatch => {
        dispatch({
            type: DISCONNECT_ACCOUNT,
        });
        return deleteAccountConnection(account)
            .then(response => dispatch(disconnectAccountSuccess(response)))
            .catch(error => dispatch(disconnectAccountFailure(error)));
    };
}

function disconnectAccountSuccess(response) {
    return dispatch => {
        dispatch({
            type: DISCONNECT_ACCOUNT_SUCCESS,
            response,
        });
        dispatch(fetchSettings());
    };
}
我写的测试是:

import thunk from 'redux-thunk';
import configureMockStore from 'redux-mock-store';

...

describe('action tests', () => {
    it('should dispatch action DISCONNECT_ACCOUNT and then DISCONNECT_ACCOUNT_SUCCESS',
        async () => {
            deleteAccountConnection.mockResolvedValue('settings');
            const expectedActions = [
                {
                    type: DISCONNECT_ACCOUNT,
                },
                {
                    type: DISCONNECT_ACCOUNT_SUCCESS,
                    response: 'settings',
                },
                {
                    type: FETCH_SETTINGS,
                },
                {
                    type: FETCH_SETTINGS_SUCCESS,
                    response: 'settings',
                },
            ];
            const store = mockStore();
            await store.dispatch(disconnectAccount());
            await store.dispatch(fetchSettings());
            expect(store.getActions()).toEqual(expectedActions);
        });
如果我不在操作类型DISCONNECT\u ACCOUNT\u SUCCESS中调用fetchSettings,我就不会有问题,但是当我向它添加异步调用时,我得到了一个错误