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] Add default message to alerts. (elastic#78930)
* adding default message * addressing pr comments * addressing pr comments * addressing pr comments * addressing pr comments Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
82a6d39
commit ffc1caa
Showing
44 changed files
with
296 additions
and
139 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
52 changes: 52 additions & 0 deletions
52
x-pack/plugins/apm/common/utils/formatters/formatters.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,52 @@ | ||
/* | ||
* 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 { asPercent, asDecimalOrInteger } from './formatters'; | ||
|
||
describe('formatters', () => { | ||
describe('asPercent', () => { | ||
it('formats as integer when number is above 10', () => { | ||
expect(asPercent(3725, 10000, 'n/a')).toEqual('37%'); | ||
}); | ||
|
||
it('adds a decimal when value is below 10', () => { | ||
expect(asPercent(0.092, 1)).toEqual('9.2%'); | ||
}); | ||
|
||
it('formats when numerator is 0', () => { | ||
expect(asPercent(0, 1, 'n/a')).toEqual('0%'); | ||
}); | ||
|
||
it('returns fallback when denominator is undefined', () => { | ||
expect(asPercent(3725, undefined, 'n/a')).toEqual('n/a'); | ||
}); | ||
|
||
it('returns fallback when denominator is 0 ', () => { | ||
expect(asPercent(3725, 0, 'n/a')).toEqual('n/a'); | ||
}); | ||
|
||
it('returns fallback when numerator or denominator is NaN', () => { | ||
expect(asPercent(3725, NaN, 'n/a')).toEqual('n/a'); | ||
expect(asPercent(NaN, 10000, 'n/a')).toEqual('n/a'); | ||
}); | ||
}); | ||
|
||
describe('asDecimalOrInteger', () => { | ||
it('formats as integer when number equals to 0 ', () => { | ||
expect(asDecimalOrInteger(0)).toEqual('0'); | ||
}); | ||
it('formats as integer when number is above or equals 10 ', () => { | ||
expect(asDecimalOrInteger(10.123)).toEqual('10'); | ||
expect(asDecimalOrInteger(15.123)).toEqual('15'); | ||
}); | ||
it('formats as decimal when number is below 10 ', () => { | ||
expect(asDecimalOrInteger(0.25435632645)).toEqual('0.3'); | ||
expect(asDecimalOrInteger(1)).toEqual('1.0'); | ||
expect(asDecimalOrInteger(3.374329704990765)).toEqual('3.4'); | ||
expect(asDecimalOrInteger(5)).toEqual('5.0'); | ||
expect(asDecimalOrInteger(9)).toEqual('9.0'); | ||
}); | ||
}); | ||
}); |
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
File renamed without changes.
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
File renamed without changes.
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
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
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
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
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
Oops, something went wrong.