test: switch to node.js test runner
[e-mobility-charging-stations-simulator.git] / test / utils / StatisticUtils.test.ts
index 6fb3048873608ae896cfb23ecace504f00f7c7b6..d9aadf0c5e77426f6170104799048ba79533c426 100644 (file)
@@ -1,23 +1,25 @@
+import { describe, it } from 'node:test';
+
 import { expect } from 'expect';
 
 import { average, median, nthPercentile, stdDeviation } from '../../src/utils/StatisticUtils';
 
-describe('StatisticUtils test suite', () => {
-  it('Verify average()', () => {
+await describe('StatisticUtils test suite', async () => {
+  await it('Verify average()', () => {
     expect(average([])).toBe(0);
     expect(average([0.08])).toBe(0.08);
     expect(average([0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03])).toBe(3.1642857142857146);
     expect(average([0.25, 4.75, 3.05, 6.04, 1.01, 2.02])).toBe(2.8533333333333335);
   });
 
-  it('Verify median()', () => {
+  await it('Verify median()', () => {
     expect(median([])).toBe(0);
     expect(median([0.08])).toBe(0.08);
     expect(median([0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03])).toBe(3.05);
     expect(median([0.25, 4.75, 3.05, 6.04, 1.01, 2.02])).toBe(2.535);
   });
 
-  it('Verify nthPercentile()', () => {
+  await it('Verify nthPercentile()', () => {
     expect(nthPercentile([], 25)).toBe(0);
     expect(nthPercentile([0.08], 50)).toBe(0.08);
     const array0 = [0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03];
@@ -30,7 +32,7 @@ describe('StatisticUtils test suite', () => {
     expect(nthPercentile(array0, 100)).toBe(6.04);
   });
 
-  it('Verify stdDeviation()', () => {
+  await it('Verify stdDeviation()', () => {
     expect(stdDeviation([0.25, 4.75, 3.05, 6.04, 1.01, 2.02, 5.03])).toBe(2.0256064851429216);
   });
 });