我有一個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調用。
有沒有人有類似單元測試的經驗?