diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 30f32cd..4cd48bc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: | diff --git a/test/index.test.ts b/test/index.test.ts index d06d6e7..a5f8650 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -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]);