Skip to content

Commit

Permalink
Merge branch 'release/4.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
codenirvana committed Sep 11, 2023
2 parents 1bee9fd + 159a22b commit ee2cc8d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 12 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
4.2.1:
date: 2023-09-11
fixed bugs:
- >-
GH-1332 Fixed a bug where `Variable~update` was not updating the
description
chores:
- Updated dependencies

4.2.0:
date: 2023-08-03
new features:
Expand Down
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postman-collection",
"version": "4.2.0",
"version": "4.2.1",
"description": "Enables developers to use a unified Postman Collection format Object across projects",
"author": "Postman Inc.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -50,7 +50,7 @@
"bipbip": "^0.4.2",
"browserify": "^17.0.0",
"btoa": "^1.2.1",
"chai": "^4.3.7",
"chai": "^4.3.8",
"chalk": "^4.1.2",
"dependency-check": "^4.1.0",
"eslint": "^7.32.0",
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
25 changes: 19 additions & 6 deletions test/unit/variable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Variable', function () {
});

it('should initialize variable with correct system value', function () {
var v = new Variable();
let v = new Variable();

expect(v.system).to.be.undefined;

Expand All @@ -28,7 +28,7 @@ describe('Variable', function () {
});

it('should update the sytem property of a variable', function () {
var v = new Variable();
let v = new Variable();

v.update({ system: true });
expect(v.system).to.be.true;
Expand All @@ -40,8 +40,21 @@ describe('Variable', function () {
expect(v.system).to.be.false;
});

it('should update the description property of a variable', function () {
let v = new Variable();

v.update({ description: 'Hello' });
expect(v.description.content).to.equal('Hello');

v = new Variable({
description: true
});
v.update({ description: 'world' });
expect(v.description.content).to.equal('world');
});

it('should update the disabled property of a variable', function () {
var v = new Variable();
let v = new Variable();

v.update({ disabled: true });
expect(v.disabled).to.be.true;
Expand All @@ -54,7 +67,7 @@ describe('Variable', function () {
});

it('should prepopulate value and type when passed to the constructor (string)', function () {
var v = new Variable({
let v = new Variable({
value: 'Picard',
type: 'string'
});
Expand All @@ -66,7 +79,7 @@ describe('Variable', function () {
});

it('should prepopulate value and type when passed to the constructor (number)', function () {
var v = new Variable({
let v = new Variable({
value: 42,
type: 'number'
});
Expand All @@ -78,7 +91,7 @@ describe('Variable', function () {
});

it('should prepopulate value and type when passed to the constructor (boolean)', function () {
var v = new Variable({
let v = new Variable({
value: true,
type: 'boolean'
});
Expand Down

0 comments on commit ee2cc8d

Please sign in to comment.