测试redux操作以匹配expect,但失败
我正在学习如何编写测试,并查看redux文档以编写类似于文档的测试。 我的项目是由CreateReact应用程序创建的 我的意思是: 我的代码:测试redux操作以匹配expect,但失败,redux,Redux,我正在学习如何编写测试,并查看redux文档以编写类似于文档的测试。 我的项目是由CreateReact应用程序创建的 我的意思是: 我的代码: import configureMockStore from "redux-mock-store"; import thunk from "redux-thunk"; import * as actions from "../app/store/account/actions"; impor
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";
import * as actions from "../app/store/account/actions";
import * as actionTypes from "../app/store/account/actionTypes";
import fetchMock from "fetch-mock-jest";
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
describe("async actions", () => {
it("create GET_ACCOUNT_IMAGE when fetching images has been done", () => {
fetchMock.get("https://aws.random.cat/meow", 200);
const expectedActions = [
{ type: actionTypes.START_FETCH_ACCOUNT_IMAGE },
{ type: actionTypes.GET_ACCOUNT_IMAGE },
];
const store = mockStore({});
return store
.dispatch(actions.getAccountImage("https://aws.random.cat/meow"))
.then(() => {
// return of async actions
expect(store.getActions()).toEqual(expectedActions);
});
});
});
我的错误消息: