Skip to content

Commit

Permalink
test(unit): added test for inject to test with payloadType null
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Krec committed Nov 7, 2022
1 parent 692ea60 commit bb0c692
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/units/opcua-iiot-inject.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,22 @@ describe('OPC UA Inject node Unit Testing', function () {
})
})

it('should send a message payload Date with invalid payloadType = null and empty payload', function (done) {
const flow = Array.from(testFlows.testInjectFlow)
flow[1].payload = ""
flow[1].payloadType = null
helper.load([inputNode], flow, function () {
const n1 = helper.getNode('n2ijf1')
n1.on('input', function (msg) {

expect(msg.payload).toBeDefined()
expect(msg.payload.value).toBeGreaterThan(1000000000000)
expect(msg.payload.payloadType).toBe(null)
done()
})
})
})

it('should fail on inject button request with wrong id', function (done) {
helper.load([inputNode], testFlows.testInjectFlow, function () {
helper.request()
Expand Down

0 comments on commit bb0c692

Please sign in to comment.