[英]Firebase Jest auth/network-request-failed' error
我正在尝试使用 Jest 进行 Firebase 测试。 这是我的测试用例。
test('Test Firebase Connection', done => {
let history = [];
function callback(history) {
expect(history[0]).toBe('/dashboard');
done();
}
firebaseDAO.init('myEmail', 'mypassword', history);
setTimeout(callback, 4000,history);
});
export const init = (username, passwordPassed, history) => {
let historyData = history;
const email = username;
const password = passwordPassed;
const auth = firebase.auth();
const promise = auth.signInWithEmailAndPassword(email, password);
promise.catch(e => console.log(e));
promise.then(() => {historyData.push('/dashboard');});
};
当我使用Idea-Webstorm-Jest
插件运行测试时,它运行正常。 (测试通过。)但是当我尝试使用npm Test
命令时。 Firebase 给我以下错误。
{code: 'auth.network-request-failed', message: 'A.network error (such as timeout, interrupted connection or unreachable host) has occurred.' }
那么为什么运行npm Test
命令会失败呢? 任何人都可以帮助我吗? 提前致谢。
我也有这个问题,我找了谷歌,我发现我在 html 中的输入或按钮是类型:“提交”,这使页面刷新,最好输入“按钮”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.