-
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.
Uses SavedObjectsClient for UI Settings (#12747)
- Loading branch information
1 parent
42fe210
commit 44dedd6
Showing
9 changed files
with
59 additions
and
92 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/ui/ui_settings/__tests__/lib/create_objects_client_stub.js
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,28 @@ | ||
import sinon from 'sinon'; | ||
import expect from 'expect.js'; | ||
|
||
export function createObjectsClientStub(type, id, esDocSource = {}) { | ||
const savedObjectsClient = { | ||
update: sinon.stub().returns(Promise.resolve()), | ||
get: sinon.stub().returns({ attributes: esDocSource }) | ||
}; | ||
|
||
savedObjectsClient.assertGetQuery = () => { | ||
sinon.assert.calledOnce(savedObjectsClient.get); | ||
|
||
const { args } = savedObjectsClient.get.getCall(0); | ||
expect(args[0]).to.be(type); | ||
expect(args[1]).to.eql(id); | ||
}; | ||
|
||
savedObjectsClient.assertUpdateQuery = (expectedChanges) => { | ||
sinon.assert.calledOnce(savedObjectsClient.update); | ||
|
||
const { args } = savedObjectsClient.update.getCall(0); | ||
expect(args[0]).to.be(type); | ||
expect(args[1]).to.eql(id); | ||
expect(args[2]).to.eql(expectedChanges); | ||
}; | ||
|
||
return savedObjectsClient; | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
export { createCallClusterStub } from './call_cluster_stub'; | ||
export { createObjectsClientStub } from './create_objects_client_stub'; |
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
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
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
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
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