Skip to content

Commit

Permalink
fix metadataSeed improperly merged and returned IdentityModel#1305
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Feb 15, 2021
1 parent 9077300 commit c735ad6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/MetadataService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/unit/MetadataService.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ 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"});

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();
});
Expand Down

0 comments on commit c735ad6

Please sign in to comment.