From 5010ce2f3305ee34bde01d1e4fcf4c6d69546d54 Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Thu, 8 Feb 2024 18:19:05 +0100 Subject: [PATCH] [Discover] Fix existing migration tests --- .../saved_objects/search_migrations.test.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/plugins/saved_search_so/server/saved_objects/search_migrations.test.ts b/src/plugins/saved_search_so/server/saved_objects/search_migrations.test.ts index 9d72fecb926d3..533dbe6e61001 100644 --- a/src/plugins/saved_search_so/server/saved_objects/search_migrations.test.ts +++ b/src/plugins/saved_search_so/server/saved_objects/search_migrations.test.ts @@ -9,9 +9,16 @@ import { SavedObjectMigrationContext, SavedObjectUnsanitizedDoc } from '@kbn/core/server'; import { SavedObjectsUtils } from '@kbn/core-saved-objects-utils-server'; import { getAllMigrations, searchMigrations } from './search_migrations'; +import { makeLensEmbeddableFactory } from '@kbn/lens-plugin/server/embeddable/make_lens_embeddable_factory'; const savedObjectMigrationContext = null as unknown as SavedObjectMigrationContext; +const lensEmbeddableFactory = makeLensEmbeddableFactory( + () => ({}), + () => ({}), + {} +); + const testMigrateMatchAllQuery = (migrationFn: Function) => { it('should migrate obsolete match_all query', () => { const migratedDoc = migrationFn( @@ -366,8 +373,11 @@ Object { const versionToTest = '9.1.1'; const migrations = getAllMigrations({ - // providing a function for search source migration that's just setting `migrated` to true - [versionToTest]: (state) => ({ ...state, migrated: true }), + searchSourceMigrations: { + // providing a function for search source migration that's just setting `migrated` to true + [versionToTest]: (state) => ({ ...state, migrated: true }), + }, + lensEmbeddableFactory, }); expect( @@ -398,7 +408,10 @@ Object { const versionToTest = '9.1.2'; const migrations = getAllMigrations({ - [versionToTest]: (state) => ({ ...state, migrated: true }), + searchSourceMigrations: { + [versionToTest]: (state) => ({ ...state, migrated: true }), + }, + lensEmbeddableFactory, }); expect(