Skip to content

Commit

Permalink
Allow description as a property in variable to be updated via upsert
Browse files Browse the repository at this point in the history
  • Loading branch information
jatin3893 committed Sep 5, 2023
1 parent 89e1049 commit 764ba6f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/collection/variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ _.assign(Variable.prototype, /** @lends Variable.prototype */ {
_.has(options, 'value') && this.set(options.value);
_.has(options, 'system') && (this.system = options.system);
_.has(options, 'disabled') && (this.disabled = options.disabled);
_.has(options, 'description') && (this.describe(options.description));
}
});

Expand Down
22 changes: 22 additions & 0 deletions test/unit/variable-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,28 @@ describe('VariableList', function () {
});
});

describe('.assimilate', function () {
it('should retain description post assimilate', function () {
const variableList = new VariableList(),
pathParams = [
{
key: 'spacecraftId',
value: '<string>',
description: 'PATH_PARAM_DESCRIPTION',
disabled: false
}
];

variableList.add({
key: 'spacecraftId',
value: '<string>'
});
variableList.assimilate(pathParams, true);
expect(variableList.members[0].description.content).to.equal('PATH_PARAM_DESCRIPTION');
expect(variableList.members[0].description.type).to.equal('text/plain');
});
});

describe('.syncToObject', function () {
it('should use a default blank target object if the provided target is not an object', function () {
var list = new VariableList(null, [
Expand Down

0 comments on commit 764ba6f

Please sign in to comment.