Files
T

27 lines
739 B
JavaScript
Raw Permalink Normal View History

// @flow
import * as React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies
import { throwRemovedFunctionError } from './helpers/errors';
/**
* Renders test component shallowly using react-test-renderer/shallow
*/
2020-03-18 13:03:21 +01:00
export function shallowInternal(
instance: ReactTestInstance | React.Element<any>
) {
const renderer = new ShallowRenderer();
renderer.render(React.createElement(instance.type, instance.props));
return {
output: renderer.getRenderOutput(),
};
}
2020-03-18 13:03:21 +01:00
export default function shallow(_: ReactTestInstance | React.Element<any>) {
throwRemovedFunctionError(
'shallow',
'migration-v2#removed-global-shallow-function'
);
2020-03-18 13:03:21 +01:00
}