Skip to content

Commit

Permalink
FIX forbidden option that had no effect
Browse files Browse the repository at this point in the history
  • Loading branch information
fisuda committed May 26, 2023
1 parent 10c83e1 commit 56514e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
## node-red-contrib-letsfiware-NGSI v0.14.0-next

- FIX forbidden option that had no effect (#137)
- ADD GitHub action to close inactive issues (#136)
- ADD feature for encoding and decoding forbidden chars (#135)
- ADD encode / decode node (#133)
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/NGSI/batch-update/batch-update.js
Expand Up @@ -88,7 +88,7 @@ const createParam = function (msg, config, openAPIsConfig) {
}
defaultConfig.data.actionType = msg.payload.actionType;
defaultConfig.data.entities = msg.payload.entities;
const options = ['keyValues', 'overrideMetadata', 'forcedUpdate', 'flowControl'];
const options = ['keyValues', 'overrideMetadata', 'forcedUpdate', 'flowControl', 'forbidden'];
for (let i = 0; i < options.length; i++) {
const e = options[i];
if (msg.payload[e]) {
Expand Down
20 changes: 20 additions & 0 deletions test/unit/batch-update_spec.js
Expand Up @@ -367,6 +367,26 @@ describe('batch-update.js', () => {
assert.equal(actual, null);
assert.deepEqual(msg, { payload: { error: 'keyValues not boolean' } });
});
it('not boolean (forbidden)', () => {
const createParam = batchUpdateNode.__get__('createParam');
const msg = { payload: { actionType: 'append', entities: [], forbidden: 'true' } };
const config = {
servicepath: '/',
actionType: 'payload',
data: [{ id: 'E', type: 'T' }],
keyValues: 'false',
overrideMetadata: 'false',
forcedUpdate: 'false',
flowControl: 'false',
forbidden: 'false',
};
const openAPIsConfig = { geType: 'orion', apiEndpoint: 'http://orion:1026', getToken: null, service: 'openiot', servicepath: '/' };

const actual = createParam(msg, config, openAPIsConfig);

assert.equal(actual, null);
assert.deepEqual(msg, { payload: { error: 'forbidden not boolean' } });
});
it('ActionType error', () => {
const createParam = batchUpdateNode.__get__('createParam');
const msg = { payload: {} };
Expand Down

0 comments on commit 56514e8

Please sign in to comment.