2
//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 而不是我的存根。谢谢。

4

0 回答 0