X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=test%2Futils%2FStatisticUtils.test.ts;h=d9aadf0c5e77426f6170104799048ba79533c426;hb=6f8914baad517724c82ceeb9bc27672cdb7e31e2;hp=6fb3048873608ae896cfb23ecace504f00f7c7b6;hpb=c7ba22b7e881dc5f0c7f99dfa5d67390bc46fdf6;p=e-mobility-charging-stations-simulator.git diff --git a/test/utils/StatisticUtils.test.ts b/test/utils/StatisticUtils.test.ts index 6fb30488..d9aadf0c 100644 --- a/test/utils/StatisticUtils.test.ts +++ b/test/utils/StatisticUtils.test.ts @@ -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); }); });