Skip to content

Commit

Permalink
Fixed remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa committed Sep 2, 2020
1 parent ba926c8 commit 16929e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ import { UI_SETTINGS } from '../../../../data/server';

function stubRequestAndServer(response, indexPatternSavedObjects = []) {
return {
getStartServices: sinon.stub().returns(Promise.resolve([{}, { data: {search: {search: () => Promise.resolve(response)}}}])),
getStartServices: sinon
.stub()
.returns(
Promise.resolve([{}, { data: { search: { search: () => Promise.resolve(response) } } }])
),
savedObjectsClient: {
find: function () {
return Promise.resolve({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default new Datasource('es', {

const body = buildRequest(config, tlConfig, scriptedFields, esShardTimeout);

const [, deps] = await tlConfig.getStartServices();
const deps = (await tlConfig.getStartServices())[1];

const resp = await deps.data.search.search(tlConfig.context, body, {
strategy: ES_SEARCH_STRATEGY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ export default function () {
if (!functions[name]) throw new Error('No such function: ' + name);
return functions[name];
},
esDataClient: sinon.stub().returns(Promise.resolve({ rawResponse: esResponse })),
getStartServices: sinon
.stub()
.returns(
Promise.resolve([
{},
{ data: { search: { search: () => Promise.resolve({ rawResponse: esResponse }) } } },
])
),

esShardTimeout: moment.duration(30000),
allowedGraphiteUrls: ['https://www.hostedgraphite.com/UID/ACCESS_KEY/graphite'],
});
Expand Down

0 comments on commit 16929e0

Please sign in to comment.