mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Add tests to ensure infinite value mappings work (#43858)
This commit is contained in:
parent
d350ed0f35
commit
77347a37b1
@ -6,6 +6,14 @@ const testSet1: ValueMapping[] = [
|
||||
type: MappingType.ValueToText,
|
||||
options: { '11': { text: 'elva' } },
|
||||
},
|
||||
{
|
||||
type: MappingType.ValueToText,
|
||||
options: { Infinity: { text: 'wow infinity!' } },
|
||||
},
|
||||
{
|
||||
type: MappingType.ValueToText,
|
||||
options: { '-Infinity': { text: 'wow negative infinity!' } },
|
||||
},
|
||||
{
|
||||
type: MappingType.RangeToText,
|
||||
options: {
|
||||
@ -94,6 +102,16 @@ describe('Format value with value mappings', () => {
|
||||
expect(getValueMappingResult(testSet1, value)).toEqual({ text: 'elva' });
|
||||
});
|
||||
|
||||
it('should return match result for Infinity', () => {
|
||||
const value = Infinity;
|
||||
expect(getValueMappingResult(testSet1, value)).toEqual({ text: 'wow infinity!' });
|
||||
});
|
||||
|
||||
it('should return match result for -Infinity', () => {
|
||||
const value = -Infinity;
|
||||
expect(getValueMappingResult(testSet1, value)).toEqual({ text: 'wow negative infinity!' });
|
||||
});
|
||||
|
||||
it('should return match result with number value', () => {
|
||||
const value = 11;
|
||||
expect(getValueMappingResult(testSet1, value)).toEqual({ text: 'elva' });
|
||||
|
Loading…
Reference in New Issue
Block a user