From 8bcf5fe82d7ba3d70fe73ea5fb71a9f6d97d5b54 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 9 Jul 2022 14:25:19 -0500 Subject: [PATCH] Update tests for Jest v28, apply uuid hack https://github.com/uuidjs/uuid/pull/616#issuecomment-1111012599 --- app/soapbox/reducers/__tests__/contexts.test.ts | 3 ++- jest.config.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/soapbox/reducers/__tests__/contexts.test.ts b/app/soapbox/reducers/__tests__/contexts.test.ts index 901763091..29e9e3c07 100644 --- a/app/soapbox/reducers/__tests__/contexts.test.ts +++ b/app/soapbox/reducers/__tests__/contexts.test.ts @@ -2,6 +2,7 @@ import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet, fromJS, + is, } from 'immutable'; import { STATUS_IMPORT } from 'soapbox/actions/importer'; @@ -111,7 +112,7 @@ describe('contexts reducer', () => { }) as ImmutableMap>, }); - expect(reducer(state, action)).toEqual(expected); + expect(is(reducer(state, action), expected)).toBe(true); }); }); }); diff --git a/jest.config.js b/jest.config.js index 3fa667c36..468401c51 100644 --- a/jest.config.js +++ b/jest.config.js @@ -33,6 +33,10 @@ module.exports = { '/node_modules', '/app', ], + 'moduleNameMapper': { + // https://github.com/uuidjs/uuid/pull/616#issuecomment-1111012599 + '^uuid$': require.resolve('uuid'), + }, 'testMatch': ['**/*/__tests__/**/?(*.|*-)+(test).(ts|js)?(x)'], 'testEnvironment': 'jsdom', 'transformIgnorePatterns': [