verify a stub was called?
Closed this issue · 1 comments
walshe commented
is there any way with Lab/Code/Proxyquire to verify that a stub was called rather than the way I have done below ? want to avoid Sinon if I can
'use strict';
const Code = require('code');
const Lab = require('lab');
const Proxyquire = require('proxyquire');
const lab = exports.lab = Lab.script();
const NodeCronStub = {
called : false,
schedule : function (cronExpression, callback){
this.called = true;
console.log('dummy schedule');
}
};
const LookerServiceStub = {
called : false,
getLookerReport : function (callback){
this.called = true;
callback(null,[{ foo: 'bar' }]);
}
};
jedireza commented
This sounds like it falls outside the scope of this project. The short answer is there are a few ways to accomplish your goals. 😄
Here's an example of finishing a test when a stub is called:
aqua/test/client/pages/login/home/index.js
Lines 76 to 79 in b3072fa
I found a relevant issue in the code
repo issues here:
hapijs/code#66
Which led me to find a library some hapi contributors created called stand-in
:
https://github.com/continuationlabs/stand-in
I hope this helps. Happy hunting.