From 9f17e4ee2cf1aa34b27395e7d60f928251d576ea Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 11 Nov 2015 01:34:53 -0800 Subject: [PATCH] Added unit tests to verify time range fix --- public/test/specs/core/utils/rangeutil_specs.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/test/specs/core/utils/rangeutil_specs.ts b/public/test/specs/core/utils/rangeutil_specs.ts index 8816a15f73d..32286764c20 100644 --- a/public/test/specs/core/utils/rangeutil_specs.ts +++ b/public/test/specs/core/utils/rangeutil_specs.ts @@ -80,6 +80,22 @@ describe("rangeUtil", () => { var text = rangeUtil.describeTimeRange({from: 'now-13h', to: 'now'}); expect(text).to.be('Last 13 hours') }); + + it('Date range with from and to both are in now-* format', () => { + var text = rangeUtil.describeTimeRange({from: 'now-6h', to: 'now-3h'}); + expect(text).to.be('now-6h to now-3h') + }); + + it('Date range with from and to both are either in now-* or now/* format', () => { + var text = rangeUtil.describeTimeRange({from: 'now/d+6h', to: 'now-3h'}); + expect(text).to.be('now/d+6h to now-3h') + }); + + it('Date range with from and to both are either in now-* or now+* format', () => { + var text = rangeUtil.describeTimeRange({from: 'now-6h', to: 'now+1h'}); + expect(text).to.be('now-6h to now+1h') + }); + }); });