From f77d2bacb2c17202a9b33c14247e797f00f1df1d Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Sat, 20 Apr 2024 23:01:27 +0900 Subject: [PATCH] fix --- src/concurrency/resource-pool.spec.ts | 2 +- src/stress/orderBy.spec.ts | 12 ------------ src/stress/sortBy.spec.ts | 12 ++++++++++++ 3 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 src/stress/orderBy.spec.ts create mode 100644 src/stress/sortBy.spec.ts diff --git a/src/concurrency/resource-pool.spec.ts b/src/concurrency/resource-pool.spec.ts index e78f0f8..f9f3a6e 100644 --- a/src/concurrency/resource-pool.spec.ts +++ b/src/concurrency/resource-pool.spec.ts @@ -37,7 +37,7 @@ describe(ResourcePool.name, () => { testee.use(() => wait(0.5e3)); const becameEmpty = await testee.wait({ freeCount: 2 }); expect(becameEmpty).toBeTruthy(); - expect(Date.now() - start).toBeGreaterThan(0.5e3); + expect(Date.now() - start).toBeGreaterThanOrEqual(0.5e3); }); it('returns false when other tasks running', async () => { diff --git a/src/stress/orderBy.spec.ts b/src/stress/orderBy.spec.ts deleted file mode 100644 index a8f1413..0000000 --- a/src/stress/orderBy.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { sortBy } from './sortBy'; - -describe('orderBy', () => { - it('sorts value DESC by "natural" JS ordering', () => { - expect(sortBy([2, 3, 1], (v) => v)).toEqual([3, 2, 1]); - expect(sortBy([1, 1, 2], (v) => v)).toEqual([2, 1, 1]); - }); - it('sorts value ASC by "natural" JS ordering', () => { - expect(sortBy([2, 3, 1], (v) => v, true)).toEqual([1, 2, 3]); - expect(sortBy([1, 1, 2], (v) => v, true)).toEqual([1, 1, 2]); - }); -}); diff --git a/src/stress/sortBy.spec.ts b/src/stress/sortBy.spec.ts new file mode 100644 index 0000000..bd34033 --- /dev/null +++ b/src/stress/sortBy.spec.ts @@ -0,0 +1,12 @@ +import { sortBy } from './sortBy'; + +describe('orderBy', () => { + it('sorts value DESC by "natural" JS ordering', () => { + expect(sortBy([2, 3, 1], (v) => v, false)).toEqual([3, 2, 1]); + expect(sortBy([1, 1, 2], (v) => v, false)).toEqual([2, 1, 1]); + }); + it('sorts value ASC by "natural" JS ordering', () => { + expect(sortBy([2, 3, 1], (v) => v)).toEqual([1, 2, 3]); + expect(sortBy([1, 1, 2], (v) => v)).toEqual([1, 1, 2]); + }); +});