X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/a7cf03c192470cbab13edeb1aec99e0c66dede10..d2cd7f1b4c318ac8587ab3dc1dec4a44b6d592fe:/src/lib/utils/resolve_after.test.ts?ds=sidebyside diff --git a/src/lib/utils/resolve_after.test.ts b/src/lib/utils/resolve_after.test.ts index 7e0cc3c..4b30d3c 100644 --- a/src/lib/utils/resolve_after.test.ts +++ b/src/lib/utils/resolve_after.test.ts @@ -1,37 +1,30 @@ import { resolveAfter } from './resolve_after'; describe('Resolve After', () => { - - test('it should throw if given 0', () => { - - expect(() => { - - resolveAfter(0); - }).toThrow(); - }); - - test('it should throw if given a negative number', () => { - - expect(() => { - - resolveAfter(-1); - }).toThrow(); - }); - - test('it should resolve after the specified number of times', () => { - - expect(() => { - - const { counter, promise: resolveAfterThree } = resolveAfter(3); - let resolved = false; - - resolveAfterThree.then(() => (resolved = true)); - counter(); - expect(resolved).toBe(false); - counter(); - expect(resolved).toBe(false); - counter(); - expect(resolved).toBe(true); - }).toThrow(); - }); + test('it should throw if given 0', () => { + expect(() => { + resolveAfter(0); + }).toThrow(); + }); + + test('it should throw if given a negative number', () => { + expect(() => { + resolveAfter(-1); + }).toThrow(); + }); + + test('it should resolve after the specified number of times', () => { + expect(() => { + const { counter, promise: resolveAfterThree } = resolveAfter(3); + let resolved = false; + + resolveAfterThree.then(() => (resolved = true)); + counter(); + expect(resolved).toBe(false); + counter(); + expect(resolved).toBe(false); + counter(); + expect(resolved).toBe(true); + }).toThrow(); + }); });