Skip to content

Commit

Permalink
Extend the test cases to cover the static sleep method
Browse files Browse the repository at this point in the history
  • Loading branch information
kossidts committed Mar 27, 2024
1 parent 71f831f commit 5a9debb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/cjs/common.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ describe.each([
expect(result[1]).toBe(expected[1]);
expect(elapse).toBeGreaterThanOrEqual(timeout);
});

it(`Can sleep for ${timeout}ms`, async () => {
let start = process.hrtime.bigint();
const result = await resolver.sleep(timeout);
let elapse = process.hrtime.bigint() - start;
elapse = Math.ceil(Number(elapse) / 1e6);

expect(Array.isArray(result)).toBe(true);
expect(result.length).toBe(2);
expect(elapse).toBeGreaterThanOrEqual(timeout);
});
});

/**
Expand Down

0 comments on commit 5a9debb

Please sign in to comment.