mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Update to latest sinon
This commit is contained in:
@@ -151,7 +151,7 @@ describe('Node', function() {
|
||||
|
||||
it('handles thrown errors', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
sinon.stub(n,"error",function(err,msg) {});
|
||||
sinon.stub(n,"error").callsFake(function(err,msg) {});
|
||||
var message = {payload:"hello world"};
|
||||
n.on('input',function(msg) {
|
||||
throw new Error("test error");
|
||||
@@ -271,7 +271,7 @@ describe('Node', function() {
|
||||
});
|
||||
it('logs error if callback provides error', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
sinon.stub(n,"error",function(err,msg) {});
|
||||
sinon.stub(n,"error").callsFake(function(err,msg) {});
|
||||
|
||||
var message = {payload:"hello world"};
|
||||
n.on('input',function(msg, nodeSend, nodeDone) {
|
||||
@@ -723,7 +723,7 @@ describe('Node', function() {
|
||||
it('produces a metric message', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
var loginfo = {};
|
||||
sinon.stub(Log, 'log', function(msg) {
|
||||
sinon.stub(Log, 'log').callsFake(function(msg) {
|
||||
loginfo = msg;
|
||||
});
|
||||
var msg = {payload:"foo", _msgid:"987654321"};
|
||||
@@ -739,7 +739,7 @@ describe('Node', function() {
|
||||
it('returns metric value if eventname undefined', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
var loginfo = {};
|
||||
sinon.stub(Log, 'log', function(msg) {
|
||||
sinon.stub(Log, 'log').callsFake(function(msg) {
|
||||
loginfo = msg;
|
||||
});
|
||||
var msg = {payload:"foo", _msgid:"987654321"};
|
||||
@@ -751,7 +751,7 @@ describe('Node', function() {
|
||||
it('returns not defined if eventname defined', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
var loginfo = {};
|
||||
sinon.stub(Log, 'log', function(msg) {
|
||||
sinon.stub(Log, 'log').callsFake(function(msg) {
|
||||
loginfo = msg;
|
||||
});
|
||||
var msg = {payload:"foo", _msgid:"987654321"};
|
||||
|
@@ -320,7 +320,7 @@ describe('context', function() {
|
||||
|
||||
describe('external context storage',function() {
|
||||
var resourcesDir = path.resolve(path.join(__dirname,"..","resources","context"));
|
||||
var sandbox = sinon.sandbox.create();
|
||||
var sandbox = sinon.createSandbox();
|
||||
var stubGet = sandbox.stub();
|
||||
var stubSet = sandbox.stub();
|
||||
var stubKeys = sandbox.stub();
|
||||
|
@@ -177,15 +177,15 @@ describe("red/nodes/index", function() {
|
||||
|
||||
var userDir = path.join(__dirname,".testUserHome");
|
||||
before(function(done) {
|
||||
sinon.stub(log,"log",function(){});
|
||||
sinon.stub(log,"log").callsFake(function(){});
|
||||
fs.remove(userDir,function(err) {
|
||||
fs.mkdir(userDir,function() {
|
||||
sinon.stub(index, 'load', function() {
|
||||
sinon.stub(index, 'load').callsFake(function() {
|
||||
return new Promise(function(resolve,reject){
|
||||
resolve([]);
|
||||
});
|
||||
});
|
||||
sinon.stub(localfilesystem, 'getCredentials', function() {
|
||||
sinon.stub(localfilesystem, 'getCredentials').callsFake(function() {
|
||||
return new Promise(function(resolve,reject) {
|
||||
resolve({"tab1":{"b":1,"c":2}});
|
||||
});
|
||||
@@ -271,7 +271,7 @@ describe("red/nodes/index", function() {
|
||||
var randomNodeInfo = {id:"5678",types:["random"]};
|
||||
|
||||
beforeEach(function() {
|
||||
sinon.stub(registry,"getNodeInfo",function(id) {
|
||||
sinon.stub(registry,"getNodeInfo").callsFake(function(id) {
|
||||
if (id == "test") {
|
||||
return {id:"1234",types:["test"]};
|
||||
} else if (id == "doesnotexist") {
|
||||
@@ -280,7 +280,7 @@ describe("red/nodes/index", function() {
|
||||
return randomNodeInfo;
|
||||
}
|
||||
});
|
||||
sinon.stub(registry,"disableNode",function(id) {
|
||||
sinon.stub(registry,"disableNode").callsFake(function(id) {
|
||||
return Promise.resolve(randomNodeInfo);
|
||||
});
|
||||
});
|
||||
@@ -343,7 +343,7 @@ describe("red/nodes/index", function() {
|
||||
};
|
||||
|
||||
before(function() {
|
||||
sinon.stub(registry,"getNodeInfo",function(id) {
|
||||
sinon.stub(registry,"getNodeInfo").callsFake(function(id) {
|
||||
if (id == "node-red/foo") {
|
||||
return {id:"1234",types:["test"]};
|
||||
} else if (id == "doesnotexist") {
|
||||
@@ -352,7 +352,7 @@ describe("red/nodes/index", function() {
|
||||
return randomNodeInfo;
|
||||
}
|
||||
});
|
||||
sinon.stub(registry,"getModuleInfo",function(module) {
|
||||
sinon.stub(registry,"getModuleInfo").callsFake(function(module) {
|
||||
if (module == "node-red") {
|
||||
return {nodes:[{name:"foo"}]};
|
||||
} else if (module == "doesnotexist") {
|
||||
@@ -361,7 +361,7 @@ describe("red/nodes/index", function() {
|
||||
return randomModuleInfo;
|
||||
}
|
||||
});
|
||||
sinon.stub(registry,"removeModule",function(id) {
|
||||
sinon.stub(registry,"removeModule").callsFake(function(id) {
|
||||
return randomModuleInfo;
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user