test API with mock function
此篇有使用 isomorphic-fetch Library
1.fetch api
class Users {
static all() {
return fetch('https://facebook.github.io/react-native/movies.json')
.then((response) => {
if(response) {
return response.json();
}
});
}
}
export default Users;2.call fetch

3.撰寫測試的 test case

執行此test case ,成功

4.撰寫實際例子的 test case



參考
Last updated