Skip to content

Commit

Permalink
#1008: ensure deploy returns deployed items, not complete cache
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Jun 30, 2023
1 parent aa3701d commit 1ddad4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lib/util/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,15 @@ module.exports = {
* @returns {void}
*/
mergeMetadata: (type, metadataMap, overrideMID) => {
dataStore[overrideMID || currentMID][type] = Object.assign(
metadataMap,
dataStore[currentMID][type]
);
// ensure cache exists for type
dataStore[currentMID][type] ||= {};
// if overrideMID is provided, create a copy of current MID cache
if (overrideMID) {
// ! needs to be verified if this is actually needed. When discovering an issue with this method actually overriting metadataMap, this copy-logic was present and i did not want to break things
dataStore[overrideMID][type] = Object.assign({}, dataStore[currentMID][type]);
}
// merge metadataMap into existing cache
Object.assign(dataStore[overrideMID || currentMID][type] || {}, metadataMap);
},
/**
* standardized method for getting data from cache.
Expand Down
2 changes: 1 addition & 1 deletion test/type.user.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('type: user', () => {
});
it('Should create & upsert a user', async () => {
// WHEN
const expectedCache = ['testNew_user', 'testExisting_user'];
const expectedCache = ['testExisting_user', 'testNew_user'];
await handler.deploy('testInstance/_ParentBU_', ['user'], expectedCache);
// THEN
assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
Expand Down

0 comments on commit 1ddad4e

Please sign in to comment.