Skip to content

Commit

Permalink
[Discover] Fix existing migration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jughosta committed Feb 8, 2024
1 parent f8f00ce commit 5010ce2
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 5010ce2

Please sign in to comment.