凭证失败:第一个参数“token”必须是有效字符串或有效对象

时间:2017-10-22 20:51:44

标签: reactjs firebase github karma-runner karma-mocha

当我尝试运行测试时,为什么会出现以下错误:

使用firebase中的todos进行测试

  每个“挂钩”之前的

ד应切换Todo并发送UPDATE_TODO   ACTI           Chrome 61.0.3163(Windows 10 0.0.0)

  credential failed: First argument "token" must be a valid string or a valid object
  每次“挂钩”之后的

ד应切换Todo并发送UPDATE_TODO   诉权           Chrome 61.0.3163(Windows 10 0.0.0)

  TypeError: Cannot read property 'remove' of undefined
      at Context.eval (eval at <anonymous> (app/tests/actions/actions.test.j
describe('Test with todos in firebase',() => {
    var testTodoRef;
    var uid;
    var todosRef;

    beforeEach((done) => {
      var credential = firebase.auth.GithubAuthProvider.credential(process.env.GITHUB_ACCESS_TOKEN);
      console.log('XXXX',credential);
      firebase.auth().signInWithCredential(credential).then((user) => {
        uid = user.uid;
        todosRef = firebaseRef.child(`users/${uid}/todos`);

        return todosRef.remove();
      }).then(() => {
        testTodoRef = todosRef.push();

        return testTodoRef.set({
          text: 'Something to do',
          completed: false,
          createdAt: 23453453
        })
      })
      .then(() => done())
      .catch(done);
    });

    afterEach((done) => {
      todosRef.remove().then(() => done());
    });

0 个答案:

没有答案