Skip to content

Commit

Permalink
Merge pull request #811 from opentable/DX-363
Browse files Browse the repository at this point in the history
[DX-363] Registry conf.env sanitizer
  • Loading branch information
matteofigus authored Jan 24, 2018
2 parents a5ba06e + a839eee commit 62274bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/registry/domain/options-sanitiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,9 @@ module.exports = function(input) {
options.storage.options.verbosity = options.verbosity;
}

if (!options.env) {
options.env = {};
}

return options;
};
16 changes: 16 additions & 0 deletions test/unit/registry-domain-options-sanitiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,20 @@ describe('registry : domain : options-sanitiser', () => {
});
});
});

describe('when env', () => {
describe('is provided', () => {
const options = { baseUrl: 'dummy', env: { value: 'test' } };
it('should not modify it', () => {
expect(sanitise(options).env).to.deep.equal({ value: 'test' });
});
});

describe('is not provided', () => {
const options = { baseUrl: 'dummy' };
it('should initialize it as an empty {}', () => {
expect(sanitise(options).env).to.deep.equal({});
});
});
});
});

0 comments on commit 62274bd

Please sign in to comment.