test(edge): align invalid-payload test with object-payload accept behaviour
The runtime handler accepts both bare numbers and {value} object payloads
(matches the contract's units: {measure, default} pre-dispatch shape).
The edge test was still asserting the old "object payloads are ignored"
behaviour; update it to the current contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ const commands = require('../../src/commands');
|
|||||||
const { createRegistry } = require('generalFunctions');
|
const { createRegistry } = require('generalFunctions');
|
||||||
const { makeNodeStub, makeREDStub } = require('../helpers/factories');
|
const { makeNodeStub, makeREDStub } = require('../helpers/factories');
|
||||||
|
|
||||||
test('measurement topic accepts numeric strings and ignores non-numeric objects', async () => {
|
test('measurement topic accepts numeric strings and rich analog object payloads', async () => {
|
||||||
const inst = Object.create(NodeClass.prototype);
|
const inst = Object.create(NodeClass.prototype);
|
||||||
const node = makeNodeStub();
|
const node = makeNodeStub();
|
||||||
const calls = [];
|
const calls = [];
|
||||||
@@ -29,5 +29,5 @@ test('measurement topic accepts numeric strings and ignores non-numeric objects'
|
|||||||
await onInput({ topic: 'measurement', payload: '42' }, () => {}, () => {});
|
await onInput({ topic: 'measurement', payload: '42' }, () => {}, () => {});
|
||||||
await onInput({ topic: 'measurement', payload: { value: 42 } }, () => {}, () => {});
|
await onInput({ topic: 'measurement', payload: { value: 42 } }, () => {}, () => {});
|
||||||
|
|
||||||
assert.deepEqual(calls, [42]);
|
assert.deepEqual(calls, [42, 42]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user