Fix tests

This commit is contained in:
Nathan Bierema 2022-01-10 10:16:50 -05:00
parent f28948e708
commit c15eca8825
5 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import map2tree, { Node } from '../src'; import { map2tree, Node } from '../src';
import * as immutable from 'immutable'; import * as immutable from 'immutable';
test('# rootNodeKey', () => { test('# rootNodeKey', () => {

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { createRenderer } from 'react-test-renderer/shallow'; import { createRenderer } from 'react-test-renderer/shallow';
import JSONTree from '../src/index'; import { JSONTree } from '../src/index';
import JSONNode from '../src/JSONNode'; import JSONNode from '../src/JSONNode';
const BASIC_DATA = { a: 1, b: 'c' }; const BASIC_DATA = { a: 1, b: 'c' };

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { render, screen } from '@testing-library/react'; import { render, screen } from '@testing-library/react';
import StackTraceTab from '../src/StackTraceTab'; import { TraceTab } from '../src/StackTraceTab';
const actions = { const actions = {
0: { type: 'PERFORM_ACTION', action: { type: '@@INIT' } }, 0: { type: 'PERFORM_ACTION', action: { type: '@@INIT' } },
@ -14,18 +14,18 @@ const actions = {
}, },
}; };
const StackTraceTabAsAny = StackTraceTab as any; const TraceTabAsAny = TraceTab as any;
describe('StackTraceTab component', () => { describe('StackTraceTab component', () => {
it('should render with no props', async () => { it('should render with no props', async () => {
const { container } = render(<StackTraceTabAsAny />); const { container } = render(<TraceTabAsAny />);
await screen.findByTestId('stack-trace'); await screen.findByTestId('stack-trace');
expect(container.firstChild).toMatchSnapshot(); expect(container.firstChild).toMatchSnapshot();
}); });
it('should render with props, but without stack', async () => { it('should render with props, but without stack', async () => {
const { container } = render( const { container } = render(
<StackTraceTabAsAny actions={actions} action={actions[0].action} /> <TraceTabAsAny actions={actions} action={actions[0].action} />
); );
await screen.findByTestId('stack-trace'); await screen.findByTestId('stack-trace');
expect(container.firstChild).toMatchSnapshot(); expect(container.firstChild).toMatchSnapshot();
@ -33,14 +33,14 @@ describe('StackTraceTab component', () => {
it('should render the link to docs', () => { it('should render the link to docs', () => {
const { container } = render( const { container } = render(
<StackTraceTabAsAny actions={actions} action={actions[1].action} /> <TraceTabAsAny actions={actions} action={actions[1].action} />
); );
expect(container.firstChild).toMatchSnapshot(); expect(container.firstChild).toMatchSnapshot();
}); });
it('should render with trace stack', async () => { it('should render with trace stack', async () => {
const { container } = render( const { container } = render(
<StackTraceTabAsAny actions={actions} action={actions[2].action} /> <TraceTabAsAny actions={actions} action={actions[2].action} />
); );
await screen.findByTestId('stack-trace'); await screen.findByTestId('stack-trace');
expect(container.firstChild).toMatchSnapshot(); expect(container.firstChild).toMatchSnapshot();

View File

@ -53,6 +53,7 @@
"@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-babel": "^5.3.0",
"@types/jest": "^27.4.0", "@types/jest": "^27.4.0",
"@types/lodash": "^4.14.178", "@types/lodash": "^4.14.178",
"@types/node": "^16.11.17",
"@types/react": "^17.0.38", "@types/react": "^17.0.38",
"@types/react-redux": "^7.1.21", "@types/react-redux": "^7.1.21",
"@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/eslint-plugin": "^5.8.1",

View File

@ -4704,6 +4704,7 @@ __metadata:
"@rollup/plugin-babel": ^5.3.0 "@rollup/plugin-babel": ^5.3.0
"@types/jest": ^27.4.0 "@types/jest": ^27.4.0
"@types/lodash": ^4.14.178 "@types/lodash": ^4.14.178
"@types/node": ^16.11.17
"@types/prop-types": ^15.7.4 "@types/prop-types": ^15.7.4
"@types/react": ^17.0.38 "@types/react": ^17.0.38
"@types/react-redux": ^7.1.21 "@types/react-redux": ^7.1.21