X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=tests%2Futils%2FUtils.test.ts;h=615f76fa01f057c9bad1a1b60a7a0d16b4df54d4;hb=e0d3c3592f990eadb77780b324ceaa105ba44dfa;hp=60170cf9ecf0df19e53daa3e54506f649b402ee3;hpb=1f7173559059235505c4cca840d2c92a5b2daa6e;p=e-mobility-charging-stations-simulator.git diff --git a/tests/utils/Utils.test.ts b/tests/utils/Utils.test.ts index 60170cf9..615f76fa 100644 --- a/tests/utils/Utils.test.ts +++ b/tests/utils/Utils.test.ts @@ -58,13 +58,15 @@ await describe('Utils test suite', async () => { }); await it('Verify formatDurationMilliSeconds()', () => { - expect(formatDurationMilliSeconds(0)).toBe(''); + expect(formatDurationMilliSeconds(0)).toBe('0 seconds'); + expect(formatDurationMilliSeconds(900)).toBe('0 seconds'); expect(formatDurationMilliSeconds(1000)).toBe('1 second'); expect(formatDurationMilliSeconds(hoursToMilliseconds(4380))).toBe('182 days 12 hours'); }); await it('Verify formatDurationSeconds()', () => { - expect(formatDurationSeconds(0)).toBe(''); + expect(formatDurationSeconds(0)).toBe('0 seconds'); + expect(formatDurationSeconds(0.9)).toBe('0 seconds'); expect(formatDurationSeconds(1)).toBe('1 second'); expect(formatDurationSeconds(hoursToSeconds(4380))).toBe('182 days 12 hours'); }); @@ -89,6 +91,7 @@ await describe('Utils test suite', async () => { await it('Verify convertToDate()', () => { expect(convertToDate(undefined)).toBe(undefined); + expect(convertToDate(null)).toBe(null); expect(() => convertToDate('')).toThrow(new Error("Cannot convert to date: ''")); expect(() => convertToDate('00:70:61')).toThrow( new Error("Cannot convert to date: '00:70:61'"),