forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Fix link to trace (elastic#80993) (elastic#81112)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
6f82804
commit 3386293
Showing
2 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...s/apm/public/components/app/TraceLink/get_redirect_to_transaction_detail_page_url.test.ts
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,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { getRedirectToTransactionDetailPageUrl } from './get_redirect_to_transaction_detail_page_url'; | ||
import { parse } from 'url'; | ||
|
||
describe('getRedirectToTransactionDetailPageUrl', () => { | ||
const transaction = ({ | ||
'@timestamp': '2020-01-01T00:01:00.000Z', | ||
service: { name: 'opbeans-node' }, | ||
trace: { id: 'trace_id' }, | ||
transaction: { | ||
id: 'transaction_id', | ||
name: 'transaction_name', | ||
type: 'request', | ||
duration: { us: 5000 }, | ||
}, | ||
} as unknown) as any; | ||
|
||
const url = getRedirectToTransactionDetailPageUrl({ transaction }); | ||
|
||
it('rounds the start time down', () => { | ||
expect(parse(url, true).query.rangeFrom).toBe('2020-01-01T00:00:00.000Z'); | ||
}); | ||
|
||
it('rounds the end time up', () => { | ||
expect(parse(url, true).query.rangeTo).toBe('2020-01-01T00:05:00.000Z'); | ||
}); | ||
|
||
it('formats url correctly', () => { | ||
expect(url).toBe( | ||
'/services/opbeans-node/transactions/view?traceId=trace_id&transactionId=transaction_id&transactionName=transaction_name&transactionType=request&rangeFrom=2020-01-01T00%3A00%3A00.000Z&rangeTo=2020-01-01T00%3A05%3A00.000Z' | ||
); | ||
}); | ||
}); |
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