-
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.
[Uptime] waterfall add fallback support for uncommon mime types (#88691…
…) (#88905) * uptime waterfall add fallback support for uncommon mime types * update data_formatting test Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
3ce875d
commit ac7c281
Showing
3 changed files
with
48 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
*/ | ||
|
||
import { colourPalette, getSeriesAndDomain } from './data_formatting'; | ||
import { NetworkItems } from './types'; | ||
import { NetworkItems, MimeType } from './types'; | ||
import { WaterfallDataEntry } from '../../waterfall/types'; | ||
|
||
describe('Palettes', () => { | ||
it('A colour palette comprising timing and mime type colours is correctly generated', () => { | ||
|
@@ -136,6 +137,31 @@ describe('getSeriesAndDomain', () => { | |
}, | ||
]; | ||
|
||
const networkItemsWithUncommonMimeType: NetworkItems = [ | ||
{ | ||
timestamp: '2021-01-05T19:22:28.928Z', | ||
method: 'GET', | ||
url: 'https://unpkg.com/[email protected]/build/director.js', | ||
status: 200, | ||
mimeType: 'application/x-javascript', | ||
requestSentTime: 18098833.537, | ||
requestStartTime: 18098837.233999997, | ||
loadEndTime: 18098977.648000002, | ||
timings: { | ||
blocked: 84.54599999822676, | ||
receive: 3.068000001803739, | ||
queueing: 3.69700000010198, | ||
proxy: -1, | ||
total: 144.1110000014305, | ||
wait: 52.56100000042352, | ||
connect: -1, | ||
send: 0.2390000008745119, | ||
ssl: -1, | ||
dns: -1, | ||
}, | ||
}, | ||
]; | ||
|
||
it('formats timings', () => { | ||
const actual = getSeriesAndDomain(networkItems); | ||
expect(actual).toMatchInlineSnapshot(` | ||
|
@@ -456,4 +482,22 @@ describe('getSeriesAndDomain', () => { | |
} | ||
`); | ||
}); | ||
|
||
it('handles formatting when mime type is not mapped to a specific mime type bucket', () => { | ||
const actual = getSeriesAndDomain(networkItemsWithUncommonMimeType); | ||
const { series } = actual; | ||
/* verify that raw mime type appears in the tooltip config and that | ||
* the colour is mapped to mime type other */ | ||
const contentDownloadedingConfigItem = series.find((item: WaterfallDataEntry) => { | ||
const { tooltipProps } = item.config; | ||
if (tooltipProps && typeof tooltipProps.value === 'string') { | ||
return ( | ||
tooltipProps.value.includes('application/x-javascript') && | ||
tooltipProps.colour === colourPalette[MimeType.Other] | ||
); | ||
} | ||
return false; | ||
}); | ||
expect(contentDownloadedingConfigItem).toBeDefined(); | ||
}); | ||
}); |
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