Skip to content

Commit

Permalink
test: add test for null and empty deferredPromises.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jan 2, 2024
1 parent c78f59c commit 5dbac24
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/dwait.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ describe("dwait Tests", () => {
const dwaitPromise2 = dwait(resolveClass());

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 16 on macos-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 16 on windows-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 16 on ubuntu-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 18 on macos-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 18 on windows-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 18 on ubuntu-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 20 on macos-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 20 on windows-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 157 in tests/dwait.spec.ts

View workflow job for this annotation

GitHub Actions / Node 20 on ubuntu-latest

'dwaitPromise2' is assigned a value but never used. Allowed unused vars must match /^_/u
expect(dwaitPromise1).toBe(dwaitPromise1);
});

test("should throw on accessing properties on null or undefined deferred operations", async () => {
const nullPromise = dwait(null)[NUMBER];
const undefinedPromise = dwait(undefined)[NUMBER];
await expect(nullPromise).rejects.toEqual(
new RangeError(`Property ${NUMBER} does not exists on null.`)
);
await expect(undefinedPromise).rejects.toEqual(
new RangeError(`Property ${NUMBER} does not exists on undefined.`)
);
});
});

describe("isDeferredPromise Tests", () => {
Expand Down

0 comments on commit 5dbac24

Please sign in to comment.