import { shallow } from 'enzyme'; import 'jest-enzyme'; import * as React from 'react'; import { JSONSchema4 } from 'json-schema'; import { JsonSchemaViewer, SchemaTree } from '../../components'; import { isSchemaViewerEmpty } from '../../utils/isSchemaViewerEmpty'; jest.mock('../../utils/isSchemaViewerEmpty'); jest.mock('../../components/SchemaTree', () => ({ SchemaTree() { return
; }, })); const schema: JSONSchema4 = { properties: { data: { items: { $ref: '#/definitions/Gif', }, type: 'array', }, meta: { $ref: '#/definitions/Meta', }, pagination: { $ref: '#/definitions/Pagination', }, }, }; describe('JSON Schema Viewer component', () => { beforeEach(() => { (isSchemaViewerEmpty as jest.Mock).mockReturnValue(false); }); test('should render empty message if schema is empty', () => { (isSchemaViewerEmpty as jest.Mock).mockReturnValue(true); const wrapper = shallow(