From 1553f6dfdc6f706c6a1e399751285322fbf98595 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 28 Jul 2023 22:52:30 +0200 Subject: [PATCH] test: add extractTimeSeriesValues() test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- test/utils/Utils.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/utils/Utils.test.ts b/test/utils/Utils.test.ts index 243e8547..0a672917 100644 --- a/test/utils/Utils.test.ts +++ b/test/utils/Utils.test.ts @@ -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); -- 2.34.1