From: Jérôme Benoit Date: Fri, 23 Aug 2024 20:17:15 +0000 (+0200) Subject: test: improve AsyncLock test coverage X-Git-Tag: ocpp-server@v1.5.2~91 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=aff8ddb379f1d6659ae6aac4d23acfecde6ceef9;p=e-mobility-charging-stations-simulator.git test: improve AsyncLock test coverage Signed-off-by: Jérôme Benoit --- diff --git a/tests/utils/AsyncLock.test.ts b/tests/utils/AsyncLock.test.ts index 3ab1dcf5..801cd023 100644 --- a/tests/utils/AsyncLock.test.ts +++ b/tests/utils/AsyncLock.test.ts @@ -1,4 +1,5 @@ import { expect } from 'expect' +import { randomInt } from 'node:crypto' import { describe, it } from 'node:test' import { AsyncLock, AsyncLockType } from '../../src/utils/AsyncLock.js' @@ -28,7 +29,7 @@ await describe('AsyncLock test suite', async () => { let count = 0 const asyncFn = async () => { await new Promise(resolve => { - setTimeout(resolve, 100) + setTimeout(resolve, randomInt(1, 100)) }) executed.push(++count) }