From: Jérôme Benoit Date: Fri, 28 Jul 2023 20:52:30 +0000 (+0200) Subject: test: add extractTimeSeriesValues() test X-Git-Tag: v1.2.20~102 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1553f6dfdc6f706c6a1e399751285322fbf98595;p=e-mobility-charging-stations-simulator.git test: add extractTimeSeriesValues() test Signed-off-by: Jérôme Benoit --- 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);