7.12 migration test (#94430)

* 7.12 migration test

* improve test
This commit is contained in:
Liza Katz 2021-03-11 21:18:51 +02:00 committed by GitHub
parent a5be04d17b
commit 67ecc2051a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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'];