Google Cloud Functions:如何为单元测试保留firebase队列?

时间:2017-12-06 03:12:34

标签: firebase sinon google-cloud-functions firebase-queue

//index.js
const functions = require('firebase-functions');
var Queue = require('firebase-queue');

var specQueue = new Queue();

//test.js
var assert = require('assert');
var sinon = require('sinon');
describe('test', function() {
  var Queue, firebaseQueueStub;

  before(() => {
    Queue =  require('firebase-queue');
    firebaseQueueStub = sinon.createStubInstance(Queue);
    myFunctions = require('../index');
  });

  describe('CREATED', function() {
      it('should return -1 when the value is not present', function() {
            assert.equal(-1, [1,5,3].indexOf(4));
          });
    });
});

如何在index.js中存根firebase队列构造函数?我已经尝试了上面的内容,但仍在调用firebase-queue而不是我的存根。感谢。

0 个答案:

没有答案