Skip to content

Commit

Permalink
Split out the legacy kpi bookmark and folder into their own resource …
Browse files Browse the repository at this point in the history
…files
  • Loading branch information
NZepeda committed Sep 18, 2024
1 parent 22ecfc2 commit 1cde91f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
16 changes: 16 additions & 0 deletions src/4.3_to_5.0/__test_resources__/legacyKpiWithInvalidTitle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* The content entry for a legacy bookmark representing a KPI widget
*/
export const legacyKpiWithInvalidTitle = {
entry: {
content:
'{"description": "A KPI containing a custom title with an empty tupleKey","name":"KPI","type":"container","value": {"style": {},"showTitleBar": true,"body": {"serverUrl": "","mdx": "SELECT NON EMPTY Hierarchize(AddCalculatedMembers(Descendants({[Geography].[City].[ALL].[AllMember]},1,SELF_AND_BEFORE))) ON ROWS,NON EMPTY {[Measures].[contributors.COUNT]} ON COLUMNS FROM (SELECT[Geography].[City].[ALL].[AllMember].[New York] ON COLUMNS FROM [EquityDerivativesCube])","contextValues": {},"updateMode": "once","ranges": {"row": {},"column": {}},"configuration": {"featuredValues": {"locations":{"":{"title": "Title with empty tupleKey"},"[Measures].[contributors.COUNT]": {"title": "Custom title for contributors.COUNT"}}}}},"containerKey":"featured-values"},"writable": true}',
isDirectory: false,
owners: ["admin"],
readers: ["admin"],
timestamp: 1607879735685,
lastEditor: "admin",
canRead: true,
canWrite: true,
},
};
13 changes: 13 additions & 0 deletions src/4.3_to_5.0/__test_resources__/legacyUIFolderWithInvalidKpi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { addLegacyBookmarkToUIFolder } from "./addLegacyBookmarkToUIFolder";
import { emptyLegacyUIFolder } from "./emptyLegacyUIFolder";
import { legacyKpiWithInvalidTitle } from "./legacyKpiWithInvalidTitle";

/**
* Legacy UI folder containing a single kpi bookmark with an invalid kpi title
*/
export const legacyUIFolderWithInvalidKpiTitle = addLegacyBookmarkToUIFolder(
emptyLegacyUIFolder,
{
kpi: legacyKpiWithInvalidTitle,
},
);
22 changes: 1 addition & 21 deletions src/migrateContentServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { smallLegacyPivotFolder } from "./4.3_to_5.0/__test_resources__/smallLeg
import { smallLegacyUIFolder } from "./4.3_to_5.0/__test_resources__/smallLegacyUIFolder";
import { migrateContentServer } from "./migrateContentServer";
import _cloneDeep from "lodash/cloneDeep";
import { addLegacyBookmarkToUIFolder } from "./4.3_to_5.0/__test_resources__/addLegacyBookmarkToUIFolder";
import { emptyLegacyUIFolder } from "./4.3_to_5.0/__test_resources__/emptyLegacyUIFolder";
import { legacyUIFolderWithInvalidWidgets } from "./4.3_to_5.0/__test_resources__/legacyUIFolderWithInvalidWidgets";
import { legacyUIFolderWithInvalidKpiTitle } from "./4.3_to_5.0/__test_resources__/legacyUIFolderWithInvalidKpi";

jest.mock(`./4.3_to_5.0/generateId`, () => {
let counter = 0;
Expand Down Expand Up @@ -340,25 +339,6 @@ describe("migrateContentServer", () => {
});

it("migrates the KPI custom titles while dropping custom titles that could not be successfully migrated", async () => {
const legacyUIFolderWithInvalidKpiTitle = addLegacyBookmarkToUIFolder(
emptyLegacyUIFolder,
{
kpi: {
entry: {
content:
'{"description": "A KPI containing a custom title with an empty tupleKey","name":"KPI","type":"container","value": {"style": {},"showTitleBar": true,"body": {"serverUrl": "","mdx": "SELECT NON EMPTY Hierarchize(AddCalculatedMembers(Descendants({[Geography].[City].[ALL].[AllMember]},1,SELF_AND_BEFORE))) ON ROWS,NON EMPTY {[Measures].[contributors.COUNT]} ON COLUMNS FROM (SELECT[Geography].[City].[ALL].[AllMember].[New York] ON COLUMNS FROM [EquityDerivativesCube])","contextValues": {},"updateMode": "once","ranges": {"row": {},"column": {}},"configuration": {"featuredValues": {"locations":{"":{"title": "Title with empty tupleKey"},"[Measures].[contributors.COUNT]": {"title": "Custom title for contributors.COUNT"}}}}},"containerKey":"featured-values"},"writable": true}',
isDirectory: false,
owners: ["admin"],
readers: ["admin"],
timestamp: 1607879735685,
lastEditor: "admin",
canRead: true,
canWrite: true,
},
},
},
);

const contentServer: ContentRecord = {
children: {
ui: legacyUIFolderWithInvalidKpiTitle,
Expand Down

0 comments on commit 1cde91f

Please sign in to comment.