-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction-python_spec.js
More file actions
33 lines (30 loc) · 989 Bytes
/
function-python_spec.js
File metadata and controls
33 lines (30 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var helper = require("node-red-node-test-helper");
var pythonNode = require("../function-function.js");
describe("lower-case Node", function () {
afterEach(function () {
helper.unload();
});
it("should be loaded", function (done) {
var flow = [{ id: "n1", type: "python-function", name: "test name" }];
helper.load(pythonNode, flow, function () {
var n1 = helper.getNode("n1");
n1.should.have.property("name", "test name");
done();
});
});
it("should make payload lower case", function (done) {
var flow = [
{ id: "n1", type: "python-function", name: "test name", wires: [["n2"]] },
{ id: "n2", type: "helper" },
];
helper.load(pythonNode, flow, function () {
var n2 = helper.getNode("n2");
var n1 = helper.getNode("n1");
n2.on("input", function (msg) {
msg.should.have.property("payload", "uppercase");
done();
});
n1.receive({ payload: "UpperCase" });
});
});
});