diff --git a/packages/redux-devtools-inspector-monitor-test-tab/jest.config.js b/packages/redux-devtools-inspector-monitor-test-tab/jest.config.js index a1f53444..bae50f60 100644 --- a/packages/redux-devtools-inspector-monitor-test-tab/jest.config.js +++ b/packages/redux-devtools-inspector-monitor-test-tab/jest.config.js @@ -1,6 +1,5 @@ module.exports = { preset: 'ts-jest', - setupFilesAfterEnv: ['/test/setup.ts'], testEnvironment: 'jsdom', moduleNameMapper: { '\\.css$': '/test/__mocks__/styleMock.ts', diff --git a/packages/redux-devtools-inspector-monitor-test-tab/package.json b/packages/redux-devtools-inspector-monitor-test-tab/package.json index 9e85b4df..d7519911 100644 --- a/packages/redux-devtools-inspector-monitor-test-tab/package.json +++ b/packages/redux-devtools-inspector-monitor-test-tab/package.json @@ -60,8 +60,7 @@ "@babel/preset-typescript": "^7.15.0", "@redux-devtools/core": "^3.9.0", "@redux-devtools/inspector-monitor": "^1.0.0", - "@types/enzyme": "^3.10.10", - "@types/enzyme-adapter-react-16": "^1.0.6", + "@testing-library/react": "^12.1.2", "@types/es6template": "^1.0.0", "@types/jest": "^27.0.2", "@types/jsan": "^3.1.2", @@ -70,9 +69,6 @@ "@types/simple-diff": "^1.6.1", "@typescript-eslint/eslint-plugin": "^5.1.0", "@typescript-eslint/parser": "^5.1.0", - "enzyme": "^3.11.0", - "enzyme-adapter-react-16": "^1.15.6", - "enzyme-to-json": "^3.6.2", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-jest": "^25.2.2", diff --git a/packages/redux-devtools-inspector-monitor-test-tab/test/TestGenerator.spec.tsx b/packages/redux-devtools-inspector-monitor-test-tab/test/TestGenerator.spec.tsx index 2b50f9b7..51a15ae8 100644 --- a/packages/redux-devtools-inspector-monitor-test-tab/test/TestGenerator.spec.tsx +++ b/packages/redux-devtools-inspector-monitor-test-tab/test/TestGenerator.spec.tsx @@ -1,6 +1,5 @@ import React from 'react'; -import { render } from 'enzyme'; -import { renderToJson } from 'enzyme-to-json'; +import { render, screen } from '@testing-library/react'; import { PerformAction } from '@redux-devtools/core'; import { Action } from 'redux'; import TestGenerator from '../src/TestGenerator'; @@ -30,12 +29,12 @@ const TestGeneratorAsAny = TestGenerator as any; describe('TestGenerator component', () => { it('should show warning message when no params provided', () => { - const component = render(); - expect(renderToJson(component)).toMatchSnapshot(); + const { container } = render(); + expect(container.firstChild).toMatchSnapshot(); }); it('should be empty when no actions provided', () => { - const component = render( + const { container } = render( { useCodemirror={false} /> ); - expect(renderToJson(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); it("should match function template's test for first action", () => { - const component = render( + const { container } = render( { useCodemirror={false} /> ); - expect(renderToJson(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); it("should match string template's test for first action", () => { - const component = render( + const { container } = render( { selectedActionId={1} /> ); - expect(renderToJson(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); it('should generate test for the last action when selectedActionId not specified', () => { - const component = render( + const { container } = render( { useCodemirror={false} /> ); - expect(renderToJson(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); it('should generate test for vanilla js class', () => { - const component = render( + const { container } = render( { useCodemirror={false} /> ); - expect(renderToJson(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); it('should generate test for vanilla js class with string template', () => { - const component = render( + const { container } = render( { useCodemirror={false} /> ); - expect(renderToJson(component)).toMatchSnapshot(); + expect(container.firstChild).toMatchSnapshot(); }); }); diff --git a/packages/redux-devtools-inspector-monitor-test-tab/test/__snapshots__/TestGenerator.spec.tsx.snap b/packages/redux-devtools-inspector-monitor-test-tab/test/__snapshots__/TestGenerator.spec.tsx.snap index 11e98d86..99862500 100644 --- a/packages/redux-devtools-inspector-monitor-test-tab/test/__snapshots__/TestGenerator.spec.tsx.snap +++ b/packages/redux-devtools-inspector-monitor-test-tab/test/__snapshots__/TestGenerator.spec.tsx.snap @@ -2,13 +2,13 @@ exports[`TestGenerator component should be empty when no actions provided 1`] = `