forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a migration function for datasource to add migrationVersion fi…
- Loading branch information
1 parent
0cad69d
commit 293adfb
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/plugins/data_source/server/saved_objects/data_source.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,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { migrateDataSource } from './data_source'; | ||
import { savedObjectsServiceMock } from '../../../../core/server/mocks'; | ||
|
||
const contextMock = savedObjectsServiceMock.createMigrationContext(); | ||
|
||
describe('migrateDataSource Function', () => { | ||
it('should return the input document unchanged', () => { | ||
const mockDoc = { | ||
id: 'test-id', | ||
type: 'test-type', | ||
attributes: { | ||
name: 'Test Name', | ||
description: 'Test Description', | ||
}, | ||
references: [], | ||
}; | ||
|
||
// Call the migrateDataSource function with the mock document | ||
const result = migrateDataSource(mockDoc, contextMock); | ||
|
||
// Expect the result to be deeply equal to the mock document | ||
expect(result).toEqual(mockDoc); | ||
}); | ||
}); |
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