Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Mar 30, 2020
1 parent 56345e1 commit 4a8238f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('getLatestMonitor', () => {
hits: [
{
_source: {
'@timestamp': 123456,
timestamp: 123456,
monitor: {
id: 'testMonitor',
},
Expand All @@ -63,6 +63,7 @@ describe('getLatestMonitor', () => {
dateEnd: 'now',
monitorId: 'testMonitor',
});

expect(result.timestamp).toBe(123456);
expect(result.monitor).not.toBeFalsy();
expect(result?.monitor?.id).toBe('testMonitor');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ export const getLatestMonitor: UMElasticsearchQueryFn<GetLatestMonitorParams, Pi

const result = await callES('search', params);
const ping: any = result.hits?.hits?.[0] ?? {};
const { '@timestamp': timestamp, ...monitorResult } = ping?._source ?? {};

return {
...ping?._source,
timestamp: ping?._source?.['@timestamp'],
timestamp,
...monitorResult,
};
};
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"timestamp": "2019-09-11T03:40:34.371Z",
"observer": {
"geo": {
"name": "mpls",
"location": "37.926868, -78.024902"
},
"hostname": "avc-x1x"
},
"@timestamp": "2019-09-11T03:40:34.371Z",
"monitor": {
"duration": {
"us": 24627
Expand All @@ -25,6 +25,5 @@
"domain": "localhost",
"query": "r=200x1",
"full": "http://localhost:5678/pattern?r=200x1"
},
"timestamp": "2019-09-11T03:40:34.371Z"
}
}

0 comments on commit 4a8238f

Please sign in to comment.