File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { shallow , mount } from 'enzyme' ;
2+ import { shallow } from 'enzyme' ;
33import GoodBye , { Provider , withGoodBye } from '../src' ;
44
55describe ( '<Provider />' , ( ) => {
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { withGoodBye } from '../src' ;
3+ import { shallow } from 'enzyme' ;
4+
5+ describe ( 'withGoodBye' , ( ) => {
6+ const BaseComponent = ( ) => < div /> ;
7+ const EnhancedComponent = withGoodBye ( BaseComponent ) ;
8+
9+ test ( 'should have correct displayName' , ( ) => {
10+ expect ( EnhancedComponent . displayName ) . toBe ( `withGoodBye(${ BaseComponent . name } )` ) ;
11+ } )
12+
13+ test ( 'should receive own props from EnhancedComponent to BaseComponent' , ( ) => {
14+ const myProps = { foo : 1 , bar : 2 } ;
15+ const wrapper = shallow ( < EnhancedComponent { ...myProps } /> ) ;
16+ expect ( wrapper . dive ( ) . find ( BaseComponent ) . props ( ) . foo ) . toEqual ( 1 ) ;
17+ expect ( wrapper . dive ( ) . find ( BaseComponent ) . props ( ) . bar ) . toEqual ( 2 ) ;
18+ } )
19+
20+ test ( 'should receive getUserConfirmation prop function' , ( ) => {
21+ const wrapper = shallow ( < EnhancedComponent /> ) ;
22+ expect ( wrapper . dive ( ) . find ( BaseComponent ) . props ( ) . getUserConfirmation ) . toBeDefined ( ) ;
23+ } )
24+
25+ } ) ;
You can’t perform that action at this time.
0 commit comments