Skip to content

Commit

Permalink
fix unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jul 7, 2021
1 parent 96a1a60 commit 48074a4
Showing 1 changed file with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ describe('APM Correlations search strategy', () => {
} as unknown) as SearchStrategyDependencies;
params = {
index: 'apm-*',
start: '2020',
end: '2021',
};
});

Expand Down Expand Up @@ -154,10 +156,22 @@ describe('APM Correlations search strategy', () => {
},
query: {
bool: {
filter: [{ term: { 'processor.event': 'transaction' } }],
filter: [
{ term: { 'processor.event': 'transaction' } },
{
range: {
'@timestamp': {
format: 'epoch_millis',
gte: '2020',
lte: '2021',
},
},
},
],
},
},
size: 0,
track_total_hits: true,
})
);
});
Expand All @@ -167,11 +181,17 @@ describe('APM Correlations search strategy', () => {
it('retrieves the current request', async () => {
const searchStrategy = await apmCorrelationsSearchStrategyProvider();
const response = await searchStrategy
.search({ id: 'my-search-id', params }, {}, mockDeps)
.search({ params }, {}, mockDeps)
.toPromise();

expect(response).toEqual(
expect.objectContaining({ id: 'my-search-id' })
const searchStrategyId = response.id;

const response2 = await searchStrategy
.search({ id: searchStrategyId, params }, {}, mockDeps)
.toPromise();

expect(response2).toEqual(
expect.objectContaining({ id: searchStrategyId })
);
});
});
Expand Down Expand Up @@ -226,7 +246,7 @@ describe('APM Correlations search strategy', () => {

expect(response2.id).toEqual(response1.id);
expect(response2).toEqual(
expect.objectContaining({ loaded: 10, isRunning: false })
expect.objectContaining({ loaded: 100, isRunning: false })
);
});
});
Expand Down

0 comments on commit 48074a4

Please sign in to comment.