这个函数最好的测试方法是什么?
export function receivingItems() {
return (dispatch, getState) => {
axios.get('/api/items')
.then(function(response) {
dispatch(receivedItems(response.data));
});
};
}
这是目前我拥有的内容
describe('Items Action Creator', () => {
it('should create a receiving items function', () => {
expect(receivingItems()).to.be.a.function;
});
});
createMockStore
已经作为一个包发布了:https://github.com/arnaudbenard/redux-mock-store - Dan AbramovgetTodos
并且返回的数据是一个巨大的待办事项列表,那么该如何模拟这种情况呢? - shangsunset