Skip to content

Commit

Permalink
feat(hub-common): no longer remove dcatConfig object from site during…
Browse files Browse the repository at this point in the history
… migration

affects: @esri/hub-common
  • Loading branch information
sonofflynn89 committed Sep 27, 2021
1 parent 8daf1fd commit fb8d7fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
6 changes: 2 additions & 4 deletions packages/common/src/sites/_migrate-feed-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { IModel, cloneObject, getProp } from "..";
/**
* Migrates the site so it can store configurations for multiple feed formats
* (dcat-us-1.1, dcat-ap-2.0.1, etc.). If the site has an existing custom
* configuration for dcat-us 1.1, that configuration will be modified to
* use values from the v3 api instead of values from the index.
* configuration for dcat-us 1.1, a copy of that configuration will be modified
* to use values from the v3 api instead of values from the index.
*
* Structural Impacts:
* - site.data.feeds will be added.
* - site.data.feeds.dcatUS11 will be added if site.data.values.dcatConfig exists.
* - site.data.values.dcatConfig will be removed.
*
* @param {object} model Site Model
* @private
Expand All @@ -21,7 +20,6 @@ export function _migrateFeedConfig(model: IModel) {
const oldDcatUS11Config = clone.data.values.dcatConfig;
clone.data.feeds = {};
if (oldDcatUS11Config) {
delete clone.data.values.dcatConfig;
clone.data.feeds.dcatUS11 = _migrateToV3Values(oldDcatUS11Config);
}
clone.item.properties.schemaVersion = 1.5;
Expand Down
22 changes: 0 additions & 22 deletions packages/common/test/sites/_migrate-feed-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,6 @@ describe("_migrateFeedConfig", () => {
expect(result).toEqual(siteModel, "The site object should be unchanged.");
});

it("Removes the existing config object for dcat-us 1.1 from the site", () => {
const siteModel = {
item: {
properties: {
schemaVersion: 1.4,
},
},
data: {
values: {
dcatConfig: {
title: "custom value",
},
},
},
} as unknown as IModel;

const result = _migrateFeedConfig(siteModel);
expect(result.data.values.dcatConfig).toBeFalsy(
"site.data.values.dcatConfig should not be present"
);
});

it("Adds an empty feeds config hash when the site does not have an existing config for dcat-us 1.1", () => {
const siteModel = {
item: { properties: { schemaVersion: 1.4 } },
Expand Down

0 comments on commit fb8d7fb

Please sign in to comment.