Sfoglia il codice sorgente

Added unit tests to verify time range fix

utkarshcmu 10 anni fa
parent
commit
9f17e4ee2c
1 ha cambiato i file con 16 aggiunte e 0 eliminazioni
  1. 16 0
      public/test/specs/core/utils/rangeutil_specs.ts

+ 16 - 0
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')
+    });
+
   });
 
 });