diff --git a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidWidget.ts b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidWidget.ts index 7bc1205..eb5afb5 100644 --- a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidWidget.ts +++ b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidWidget.ts @@ -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: { diff --git a/src/migrateContentServer.test.ts b/src/migrateContentServer.test.ts index 34b03a6..fb623a0 100644 --- a/src/migrateContentServer.test.ts +++ b/src/migrateContentServer.test.ts @@ -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, @@ -294,6 +294,8 @@ describe("migrateContentServer", () => { }, }; + const contentServerBeforeMigration = _cloneDeep(contentServer); + await migrateContentServer({ contentServer, servers, @@ -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,