-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore and fix saved_objects_config.test.ts
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/core/server/saved_objects/saved_objects_config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 []`); | ||
}); | ||
}); |