Skip to content

Commit

Permalink
Restore and fix saved_objects_config.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Oct 20, 2021
1 parent b7c8ad5 commit bb8e14d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/core/server/saved_objects/saved_objects_config.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { savedObjectsMigrationConfig } from './saved_objects_config';
import { getDeprecationsFor } from '../config/test_utils';

const applyMigrationsDeprecations = (settings: Record<string, any> = {}) =>
getDeprecationsFor({
provider: savedObjectsMigrationConfig.deprecations!,
settings,
path: 'migrations',
});

describe('migrations config', function () {
describe('deprecations', () => {
it('logs a warning if migrations.enableV2 is set: true', () => {
const { messages } = applyMigrationsDeprecations({ enableV2: true });
expect(messages).toMatchInlineSnapshot(`
Array [
"You no longer need to configure \\"migrations.enableV2\\".",
]
`);
});

it('logs a warning if migrations.enableV2 is set: false', () => {
const { messages } = applyMigrationsDeprecations({ enableV2: false });
expect(messages).toMatchInlineSnapshot(`
Array [
"You no longer need to configure \\"migrations.enableV2\\".",
]
`);
});
});

it('does not log a warning if migrations.enableV2 is not set', () => {
const { messages } = applyMigrationsDeprecations({ batchSize: 1_000 });
expect(messages).toMatchInlineSnapshot(`Array []`);
});
});

0 comments on commit bb8e14d

Please sign in to comment.