Skip to content

Commit

Permalink
test(set): fix set testing
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Nov 17, 2024
1 parent 5037fed commit 46a61d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

- uses: actions/checkout@v1

- name: Use Node.js 18.x
- name: Use Node.js 22.x
uses: actions/setup-node@v1
with:
node-version: 18.x
node-version: 22.x

- name: yarn install, yarn test:coverage
run: |
Expand Down
15 changes: 15 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4089,6 +4089,21 @@ describe('set - new API', () => {
if (!Set.prototype.difference) {
return;
}
test('set - without Set.prototype.difference', () => {
// @ts-ignore
const difference = Set.prototype.difference;
// @ts-ignore
delete Set.prototype.difference;
const odds = new Set([1, 3, 5, 7, 9]);
const squares = new Set([1, 4, 9]);
const state = create(odds, (draft) => {
// @ts-ignore
expect(() => draft.difference(squares)).toThrow();
});
// @ts-ignore
Set.prototype.difference = difference;
});

test('set - Set.prototype.intersection', () => {
const odds = new Set([1, 3, 5, 7, 9]);
const squares = new Set([1, 4, 9]);
Expand Down

0 comments on commit 46a61d4

Please sign in to comment.