mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
lots of little node edits to clean up jsHint "errors"
This commit is contained in:
@@ -605,179 +605,178 @@ describe('pushbullet node', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('tickle', function() {
|
||||
it('note', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
describe('tickle', function() {
|
||||
it('note', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "note");
|
||||
msg.should.have.property("payload", "body");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('note'));
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "note");
|
||||
msg.should.have.property("payload", "body");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('note'));
|
||||
});
|
||||
});
|
||||
|
||||
it('link', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('link', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "link");
|
||||
msg.should.have.property("payload", "url");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('link'));
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "link");
|
||||
msg.should.have.property("payload", "url");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('link'));
|
||||
});
|
||||
});
|
||||
|
||||
it('address', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('address', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "address");
|
||||
msg.should.have.property("payload", "address");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('address'));
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "address");
|
||||
msg.should.have.property("payload", "address");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('address'));
|
||||
});
|
||||
});
|
||||
|
||||
it('file', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('file', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "file");
|
||||
msg.should.have.property("payload", "fileurl");
|
||||
msg.should.have.property("topic", "filename");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('file'));
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "file");
|
||||
msg.should.have.property("payload", "fileurl");
|
||||
msg.should.have.property("topic", "filename");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('file'));
|
||||
});
|
||||
});
|
||||
|
||||
it('list', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('list', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "list");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("payload").with.length(3);
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('list'));
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "list");
|
||||
msg.should.have.property("topic", "title");
|
||||
msg.should.have.property("payload").with.length(3);
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('list'));
|
||||
});
|
||||
});
|
||||
|
||||
it('delete', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('delete', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "delete");
|
||||
msg.should.have.property("payload", "pjgzwwocCCy");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('delete'));
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "delete");
|
||||
msg.should.have.property("payload", "pjgzwwocCCy");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
func.yields(false, getPushReply('delete'));
|
||||
});
|
||||
});
|
||||
|
||||
it('dismissed', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('dismissed', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "dismissal");
|
||||
msg.should.have.property("payload", "xXxXxXxXxXxsjArqXRsaZM");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var rep = getPushReply('note');
|
||||
rep.pushes[0].dismissed = true;
|
||||
func.yields(false, rep);
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}}, function() {
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
msg.should.have.property("pushtype", "dismissal");
|
||||
msg.should.have.property("payload", "xXxXxXxXxXxsjArqXRsaZM");
|
||||
msg.should.have.property("data");
|
||||
done();
|
||||
});
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var rep = getPushReply('note');
|
||||
rep.pushes[0].dismissed = true;
|
||||
func.yields(false, rep);
|
||||
});
|
||||
});
|
||||
|
||||
it('filter', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
it('filter', function(done) {
|
||||
var flow = [{id:"n1", type:"pushbullet-config"},
|
||||
{id:"n2", type:"pushbullet in", config: "n1", wires: [["n3"]]},
|
||||
{id:"n3", type:"helper"}];
|
||||
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}, n2:{filters:['a', 'b']}}, function() {
|
||||
var counter = sinon.spy();
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
counter();
|
||||
});
|
||||
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg0 = getPushReply('link'); msg0.pushes[0].source_device_iden = 'a';
|
||||
func.onCall(0).yields(false, msg0);
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg1 = getPushReply('link'); msg1.pushes[0].source_device_iden = 'b';
|
||||
func.onCall(1).yields(false, msg1);
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg2 = getPushReply('link'); msg2.pushes[0].source_device_iden = 'c';
|
||||
func.onCall(2).yields(false, msg2);
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg3 = getPushReply('link');
|
||||
delete msg3.pushes[0].source_device_iden;
|
||||
delete msg3.pushes[0].target_device_iden;
|
||||
func.onCall(3).yields(false, msg3);
|
||||
|
||||
setTimeout(function() {
|
||||
counter.callCount.should.equal(3);
|
||||
done();
|
||||
}, 100);
|
||||
helper.load(pushbulletNode, flow, {n1:{apikey:"invalid"}, n2:{filters:['a', 'b']}}, function() {
|
||||
var counter = sinon.spy();
|
||||
helper.getNode("n3").on("input", function(msg) {
|
||||
counter();
|
||||
});
|
||||
});
|
||||
|
||||
var func = sinon.stub(currentPB, "history");
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg0 = getPushReply('link'); msg0.pushes[0].source_device_iden = 'a';
|
||||
func.onCall(0).yields(false, msg0);
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg1 = getPushReply('link'); msg1.pushes[0].source_device_iden = 'b';
|
||||
func.onCall(1).yields(false, msg1);
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg2 = getPushReply('link'); msg2.pushes[0].source_device_iden = 'c';
|
||||
func.onCall(2).yields(false, msg2);
|
||||
|
||||
currentPB.streamEmitter.emit("message", {type: "tickle", subtype: "push"});
|
||||
var msg3 = getPushReply('link');
|
||||
delete msg3.pushes[0].source_device_iden;
|
||||
delete msg3.pushes[0].target_device_iden;
|
||||
func.onCall(3).yields(false, msg3);
|
||||
|
||||
setTimeout(function() {
|
||||
counter.callCount.should.equal(3);
|
||||
done();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user