Answer the question
In order to leave comments, you need to log in
Unit testing. Why is an object created with stub's, and not a module connected and stub's redefined in it?
Why are unit tests used to create an object and work with it in this way:
describe('test', function() {
var node = {
log: sinon.stub(),
services: {
block: {
getBlock: sinon.stub().callsArgWith(1, 1)
}
}
};
it('block data should be correct', function(done) {
var controller = new BlockController({node: node});
...
});
});
var Node = require('../node')
describe('test', function() {
var node = new Node();
sinon.stub(node, "log");
sinon.stub(node.services.block, "getBlock").callsArgWith(1, 1);
it('block data should be correct', function(done) {
var controller = new BlockController({node: node});
...
});
});
Спасибо!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question