redux-devtools/packages/react-json-tree/test/index.spec.tsx
Nathan Bierema 40ac89aff9
feature(react-json-tree): convert react-json-tree to TypeScript (#601)
* eslint base

* stash

* setup

* stash

* stash

* Add jest.config.js

* caught
2020-08-21 20:13:24 -04:00

23 lines
603 B
TypeScript

import React from 'react';
import { createRenderer } from 'react-test-renderer/shallow';
import JSONTree from '../src/index';
import JSONNode from '../src/JSONNode';
const BASIC_DATA = { a: 1, b: 'c' };
function render(component: React.ReactElement) {
const renderer = createRenderer();
renderer.render(component);
return renderer.getRenderOutput();
}
describe('JSONTree', () => {
it('should render basic tree', () => {
const result = render(<JSONTree data={BASIC_DATA} />);
expect(result.type).toBe('ul');
expect(result.props.children.type.name).toBe(JSONNode.name);
});
});