Skip to content

Commit

Permalink
Small edits
Browse files Browse the repository at this point in the history
  • Loading branch information
NZepeda committed Jul 29, 2024
1 parent 882272c commit 0acfad1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* The shortened version of the content of the /ui folder on a Content Server, useful for unit tests.
* Contains an invalid widget whose `containerKey` is not valid.
* Contains a widget whose `containerKey` is not valid and another widget with a filter with an invalid hierarchy.
*/
export const smallLegacyUIFolderWithInvalidWidget = {
entry: {
Expand Down
10 changes: 9 additions & 1 deletion src/migrateContentServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ describe("migrateContentServer", () => {
);
});

it("keeps 5.0 version of the widget, when the there is an error when attempting to migrate it from 5.0 to 5.1 when the `behaviorOnError` flag is set to `keep-last-successful-version`.", async () => {
it("keeps 5.0 version of the widget, when there is an error when attempting to migrate the widget from 5.0 to 5.1 when the `behaviorOnError` flag is set to `keep-last-successful-version`.", async () => {
const contentServer: ContentRecord = {
children: {
ui: smallLegacyUIFolderWithInvalidWidget,
Expand All @@ -294,6 +294,8 @@ describe("migrateContentServer", () => {
},
};

const contentServerBeforeMigration = _cloneDeep(contentServer);

await migrateContentServer({
contentServer,
servers,
Expand All @@ -305,6 +307,12 @@ describe("migrateContentServer", () => {
behaviorOnError: "keep-last-successful-version",
});

const savedWidgetContentBeforeMigration =
contentServerBeforeMigration.children?.ui.children?.bookmarks.children
?.content.children?.["1231"].entry.content;

expect(savedWidgetContentBeforeMigration.filters).not.toBeDefined();

const savedWidgetContentAfterMigration = JSON.parse(
contentServer?.children?.ui?.children?.widgets?.children?.content
?.children?.["1231"].entry.content,
Expand Down

0 comments on commit 0acfad1

Please sign in to comment.