refactor(test): code cleanups
[e-mobility-charging-stations-simulator.git] / tests / utils / Utils.test.ts
index de5b1fd79907db54f30038921abe17fc53a2f764..adf8ffeacb9c58610ee548997b0dd75b38b85812 100644 (file)
@@ -21,6 +21,7 @@ import {
   generateUUID,
   getRandomFloat,
   hasOwnProp,
+  insertAt,
   isArraySorted,
   isAsyncFunction,
   isNotEmptyArray,
@@ -380,17 +381,14 @@ await describe('Utils test suite', async () => {
     expect(isNotEmptyArray(new WeakSet())).toBe(false)
   })
 
+  await it('Verify insertAt()', () => {
+    expect(insertAt('test', 'ing', 'test'.length)).toBe('testing')
+    expect(insertAt('test', 'ing', 2)).toBe('teingst')
+  })
+
   await it('Verify isArraySorted()', () => {
-    expect(
-      isArraySorted([], (a, b) => {
-        return a - b
-      })
-    ).toBe(true)
-    expect(
-      isArraySorted([1], (a, b) => {
-        return a - b
-      })
-    ).toBe(true)
+    expect(isArraySorted([], (a, b) => a - b)).toBe(true)
+    expect(isArraySorted([1], (a, b) => a - b)).toBe(true)
     expect(isArraySorted<number>([1, 2, 3, 4, 5], (a, b) => a - b)).toBe(true)
     expect(isArraySorted<number>([1, 2, 3, 5, 4], (a, b) => a - b)).toBe(false)
     expect(isArraySorted<number>([2, 1, 3, 4, 5], (a, b) => a - b)).toBe(false)