diff --git a/src/MetadataService.js b/src/MetadataService.js index d6d2b97b..630662a3 100644 --- a/src/MetadataService.js +++ b/src/MetadataService.js @@ -59,11 +59,9 @@ export class MetadataService { .then(metadata => { Log.debug("MetadataService.getMetadata: json received"); - var mergedMetadata = this._settings.metadataSeed || {}; - Object.assign(mergedMetadata, metadata); - - this._settings.metadata = mergedMetadata; - return metadata; + var seed = this._settings.metadataSeed || {}; + this._settings.metadata = Object.assign({}, seed, metadata); + return this._settings.metadata; }); } diff --git a/test/unit/MetadataService.spec.js b/test/unit/MetadataService.spec.js index ac597094..882a19ff 100644 --- a/test/unit/MetadataService.spec.js +++ b/test/unit/MetadataService.spec.js @@ -115,7 +115,7 @@ describe("MetadataService", function() { }); }); - it("should merge metadata from seed", function(done) { + it.only("should merge metadata from seed", function(done) { settings.metadataUrl = "http://sts/metadata"; settings.metadataSeed = {test1:"one"}; stubJsonService.result = Promise.resolve({test2:"two"}); @@ -123,6 +123,7 @@ describe("MetadataService", function() { let p = subject.getMetadata(); p.then(result => { + result.should.deep.equal({test1:"one", test2:"two"}); settings.metadata.should.deep.equal({test1:"one", test2:"two"}); done(); });