diff --git a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts index dc85454b64a..3d6c565443b 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts @@ -84,4 +84,29 @@ describe('SingleStatCtrl', function() { expect(ctx.data.valueFormated).to.be('OK'); }); }); + + singleStatScenario('When range to text mapping is specifiedfor first range', function(ctx) { + ctx.setup(function() { + ctx.datapoints = [[41,50]]; + ctx.ctrl.panel.mappingType = 2; + ctx.ctrl.panel.rangeMaps = [{from: '10', to: '50', text: 'OK'},{from: '51', to: '100', text: 'NOT OK'}]; + }); + + it('Should replace value with text OK', function() { + expect(ctx.data.valueFormated).to.be('OK'); + }); + }); + + singleStatScenario('When range to text mapping is specified for other ranges', function(ctx) { + ctx.setup(function() { + ctx.datapoints = [[65,75]]; + ctx.ctrl.panel.mappingType = 2; + ctx.ctrl.panel.rangeMaps = [{from: '10', to: '50', text: 'OK'},{from: '51', to: '100', text: 'NOT OK'}]; + }); + + it('Should replace value with text NOT OK', function() { + expect(ctx.data.valueFormated).to.be('NOT OK'); + }); + }); + });