test: add extractTimeSeriesValues() test
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 28 Jul 2023 20:52:30 +0000 (22:52 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 28 Jul 2023 20:52:30 +0000 (22:52 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
test/utils/Utils.test.ts

index 243e8547731a8ba55e973a196679ddd1a3a03f06..0a672917641794060df5932b7999fbee5f0703d2 100644 (file)
@@ -8,6 +8,7 @@ import {
   convertToDate,
   convertToFloat,
   convertToInt,
+  extractTimeSeriesValues,
   formatDurationMilliSeconds,
   formatDurationSeconds,
   generateUUID,
@@ -221,6 +222,17 @@ describe('Utils test suite', () => {
     expect(randomFloat).toBeLessThanOrEqual(0);
   });
 
+  it('Verify extractTimeSeriesValues()', () => {
+    expect(extractTimeSeriesValues([])).toEqual([]);
+    expect(extractTimeSeriesValues([{ timestamp: Date.now(), value: 1.1 }])).toEqual([1.1]);
+    expect(
+      extractTimeSeriesValues([
+        { timestamp: Date.now(), value: 1.1 },
+        { timestamp: Date.now(), value: 2.2 },
+      ]),
+    ).toEqual([1.1, 2.2]);
+  });
+
   it('Verify isObject()', () => {
     expect(isObject('test')).toBe(false);
     expect(isObject(undefined)).toBe(false);