mardi 11 juillet 2017

Sinon spy use two different callback signatures

const sinon = require('sinon')

function test (use) {

  use(function (req, res) {
    return true
  })

  use(function (err, req, res, next) {
    return false
  })

}

test()

I need a way to create a spy where the first time the use function is going to be used it's passed sinon.spy({}, {}) and the second time it needs to use sinon.spy(false, {}, {}, () => {}).

Aucun commentaire:

Enregistrer un commentaire