Skip to content

Commit

Permalink
7.12 migration test (elastic#94430)
Browse files Browse the repository at this point in the history
* 7.12 migration test

* improve test
  • Loading branch information
lizozom authored and Liza K committed Mar 11, 2021
1 parent fffdfc6 commit 46befdc
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/core/server/ui_settings/saved_objects/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,39 @@ describe('ui_settings 7.9.0 migrations', () => {
});
});

describe('ui_settings 7.12.0 migrations', () => {
const migration = migrations['7.12.0'];

test('returns doc on empty object', () => {
expect(migration({} as SavedObjectUnsanitizedDoc)).toEqual({
references: [],
});
});
test('properly migrates timepicker:quickRanges', () => {
const initialQuickRange: any = {
from: '123',
to: '321',
display: 'abc',
section: 2,
};
const { section, ...migratedQuickRange } = initialQuickRange;

const doc = {
type: 'config',
id: '8.0.0',
attributes: {
buildNum: 9007199254740991,
'timepicker:quickRanges': JSON.stringify([initialQuickRange]),
},
references: [],
updated_at: '2020-06-09T20:18:20.349Z',
migrationVersion: {},
};
const migrated = migration(doc);
expect(JSON.parse(migrated.attributes['timepicker:quickRanges'])).toEqual([migratedQuickRange]);
});
});

describe('ui_settings 7.13.0 migrations', () => {
const migration = migrations['7.13.0'];

Expand Down

0 comments on commit 46befdc

Please sign in to comment.