Skip to content

Commit 3363c09

Browse files
opensearch-trigger-bot[bot]github-actions[bot]joshuarrrr
authored
[Backport 2.x] [CCI] Add bluebird replaces for src/plugins/saved_objects (#4261)
* [CCI] Add bluebird replaces for src/plugins/saved_objects (#4026) * Add bluebird replaces for src/plugins/saved_objects * Add changelog entry --------- Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com> (cherry picked from commit 55b293a) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md * update changelog Signed-off-by: Josh Romero <rmerqg@amazon.com> --------- Signed-off-by: Josh Romero <rmerqg@amazon.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Josh Romero <rmerqg@amazon.com>
1 parent 3409412 commit 3363c09

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
9090
- [Multiple DataSource] Refactor dev tool console to use opensearch-js client to send requests ([#3544](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3544))
9191
- [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693))
9292
- [Table Visualization] Move format table, consolidate types and add unit tests ([#3397](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3397))
93+
- Replace the use of `bluebird` in `saved_objects` plugin ([#4026](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4026))
9394

9495
### 🔩 Tests
9596

src/plugins/saved_objects/public/saved_object/saved_object.test.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
* under the License.
2929
*/
3030

31-
import Bluebird from 'bluebird';
3231
import { createSavedObjectClass } from './saved_object';
3332
import {
3433
SavedObject,
@@ -76,16 +75,16 @@ describe('Saved Object', () => {
7675
*/
7776
function stubOpenSearchResponse(mockDocResponse: SimpleSavedObject<SavedObjectAttributes>) {
7877
// Stub out search for duplicate title:
79-
savedObjectsClientStub.get = jest.fn().mockReturnValue(Bluebird.resolve(mockDocResponse));
80-
savedObjectsClientStub.update = jest.fn().mockReturnValue(Bluebird.resolve(mockDocResponse));
78+
savedObjectsClientStub.get = jest.fn().mockReturnValue(Promise.resolve(mockDocResponse));
79+
savedObjectsClientStub.update = jest.fn().mockReturnValue(Promise.resolve(mockDocResponse));
8180

8281
savedObjectsClientStub.find = jest
8382
.fn()
84-
.mockReturnValue(Bluebird.resolve({ savedObjects: [], total: 0 }));
83+
.mockReturnValue(Promise.resolve({ savedObjects: [], total: 0 }));
8584

8685
savedObjectsClientStub.bulkGet = jest
8786
.fn()
88-
.mockReturnValue(Bluebird.resolve({ savedObjects: [mockDocResponse] }));
87+
.mockReturnValue(Promise.resolve({ savedObjects: [mockDocResponse] }));
8988
}
9089

9190
function stubSavedObjectsClientCreate(
@@ -94,7 +93,7 @@ describe('Saved Object', () => {
9493
) {
9594
savedObjectsClientStub.create = jest
9695
.fn()
97-
.mockReturnValue(resolve ? Bluebird.resolve(resp) : Bluebird.reject(resp));
96+
.mockReturnValue(resolve ? Promise.resolve(resp) : Promise.reject(resp));
9897
}
9998

10099
/**
@@ -193,7 +192,7 @@ describe('Saved Object', () => {
193192
return createInitializedSavedObject({ type: 'dashboard', id: myId }).then((savedObject) => {
194193
savedObjectsClientStub.create = jest.fn().mockImplementation(() => {
195194
expect(savedObject.id).toBe(myId);
196-
return Bluebird.resolve({ id: myId });
195+
return Promise.resolve({ id: myId });
197196
});
198197
savedObject.copyOnSave = false;
199198

@@ -227,7 +226,7 @@ describe('Saved Object', () => {
227226
return createInitializedSavedObject({ type: 'dashboard', id }).then((savedObject) => {
228227
savedObjectsClientStub.create = jest.fn().mockImplementation(() => {
229228
expect(savedObject.isSaving).toBe(true);
230-
return Bluebird.resolve({
229+
return Promise.resolve({
231230
type: 'dashboard',
232231
id,
233232
_version: 'foo',
@@ -246,7 +245,7 @@ describe('Saved Object', () => {
246245
return createInitializedSavedObject({ type: 'dashboard' }).then((savedObject) => {
247246
savedObjectsClientStub.create = jest.fn().mockImplementation(() => {
248247
expect(savedObject.isSaving).toBe(true);
249-
return Bluebird.reject('');
248+
return Promise.reject();
250249
});
251250

252251
expect(savedObject.isSaving).toBe(false);
@@ -681,7 +680,7 @@ describe('Saved Object', () => {
681680
);
682681
indexPattern.title = indexPattern.id!;
683682
savedObject.searchSource!.setField('index', indexPattern);
684-
return Bluebird.resolve(indexPattern);
683+
return Promise.resolve(indexPattern);
685684
});
686685
expect(!!savedObject.searchSource!.getField('index')).toBe(false);
687686

0 commit comments

Comments
 (0)