我有一个actionCreator方法,我希望对其进行单元测试。它会进行一次firebase调用,如果成功或失败,它会相对调度两种方法。对涉及火力点调用的redux进行单元测试
看上去某事像这样:
export function removeItem(itemId) {
return dispatch => {
return firebase.database().ref('items').child(itemId).remove()
.then(
success => dispatch(updateList()),
error => dispatch(failRemovingItem(error))
);
};
}
我下面从终极版的例子。 http://redux.js.org/docs/recipes/WritingTests.html
但我不能通过nock来模拟firebase调用。
有没有人有类似单元测试的经验?