import * as React from 'react' ; import * as ReactDOM from 'react-dom' ; import observer from '../src/observer' ; import useContextType from '../src/useContextType' ; it ( 'should detect the React context type.' , ( ) => { let contextType = undefined ; const component = observer ( React , ( ) => < div > < /div>, () => { contextType = useContextType ( ) ; return { } ; } ) ; const container = document . createElement ( 'div' ) ; ReactDOM . render ( React . createElement ( component ) , container ) ; expect ( contextType ) . toBe ( 'react' ) ; } ) ;