mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'master' into 0.19
This commit is contained in:
@@ -524,7 +524,7 @@ describe('function node', function() {
|
||||
|
||||
it('should allow accessing node.name', function(done) {
|
||||
var flow = [{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = node.name; return msg;", "name":"name of node"},
|
||||
{id:"n2", type:"helper"}];
|
||||
{id:"n2", type:"helper"}];
|
||||
helper.load(functionNode, flow, function() {
|
||||
var n1 = helper.getNode("n1");
|
||||
var n2 = helper.getNode("n2");
|
||||
@@ -536,6 +536,21 @@ describe('function node', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should use the same Date object from outside the sandbox', function(done) {
|
||||
var flow = [{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload=global.get('typeTest')(new Date());return msg;"},
|
||||
{id:"n2", type:"helper"}];
|
||||
helper.load(functionNode, flow, function() {
|
||||
var n1 = helper.getNode("n1");
|
||||
var n2 = helper.getNode("n2");
|
||||
n1.context().global.set("typeTest",function(d) { return d instanceof Date });
|
||||
n2.on("input", function(msg) {
|
||||
msg.should.have.property('payload', true);
|
||||
done();
|
||||
});
|
||||
n1.receive({payload:"foo",topic: "bar"});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Logger', function () {
|
||||
it('should log an Info Message', function (done) {
|
||||
var flow = [{id: "n1", type: "function", wires: [["n2"]], func: "node.log('test');"}];
|
||||
|
@@ -194,8 +194,7 @@ describe("api/auth/users", function() {
|
||||
it('should fail to return user fred',function(done) {
|
||||
Users.get("fred").then(function(userf) {
|
||||
try {
|
||||
userf.should.not.have.a.property("username","fred");
|
||||
userf.should.not.have.a.property("permissions","*");
|
||||
should.not.exist(userf);
|
||||
done();
|
||||
} catch(err) {
|
||||
done(err);
|
||||
@@ -212,9 +211,12 @@ describe("api/auth/users", function() {
|
||||
default: function() { return("Done"); }
|
||||
});
|
||||
});
|
||||
after(function() {
|
||||
Users.init({});
|
||||
});
|
||||
describe('#default',function() {
|
||||
it('handles api.default being a function',function(done) {
|
||||
Users.should.have.property('default').which.is.a.Function;
|
||||
Users.should.have.property('default').which.is.a.Function();
|
||||
(Users.default()).should.equal("Done");
|
||||
done();
|
||||
});
|
||||
|
Reference in New Issue
Block a user