diff --git a/packages/grafana-data/src/utils/valueMappings.test.ts b/packages/grafana-data/src/utils/valueMappings.test.ts index 4a2dcd63299..11e76aefc94 100644 --- a/packages/grafana-data/src/utils/valueMappings.test.ts +++ b/packages/grafana-data/src/utils/valueMappings.test.ts @@ -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' });