docs: update worker section documentation
[e-mobility-charging-stations-simulator.git] / test / utils / Utils.test.ts
index 2b6df881b921f3533b285c8f1c3df7a8f6dd1431..0050f65bf42f24f229b5671d9be2daf8c3d725fa 100644 (file)
@@ -1,4 +1,4 @@
-import { hoursToMilliseconds } from 'date-fns';
+import { hoursToMilliseconds, hoursToSeconds } from 'date-fns';
 import { expect } from 'expect';
 
 import { Constants } from '../../src/utils/Constants';
@@ -9,6 +9,7 @@ import {
   convertToFloat,
   convertToInt,
   formatDurationMilliSeconds,
+  formatDurationSeconds,
   generateUUID,
   getRandomFloat,
   getRandomInteger,
@@ -56,6 +57,12 @@ describe('Utils test suite', () => {
     expect(formatDurationMilliSeconds(hoursToMilliseconds(4380))).toBe('182 days 12 hours');
   });
 
+  it('Verify formatDurationSeconds()', () => {
+    expect(formatDurationSeconds(0)).toBe('');
+    expect(formatDurationSeconds(1)).toBe('1 second');
+    expect(formatDurationSeconds(hoursToSeconds(4380))).toBe('182 days 12 hours');
+  });
+
   it('Verify isValidDate()', () => {
     expect(isValidDate(undefined)).toBe(false);
     expect(isValidDate(null)).toBe(false);