File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { shallow , mount } from 'enzyme' ;
3+
4+ import GoodBye from '../src' ;
5+
6+ describe ( 'GoodBye' , ( ) => {
7+ test ( 'should handleBeforeUnload handle function works expectedly' , ( ) => {
8+ const childFunction = jest . fn ( ) ;
9+ const fakeMsg = "hello, world." ;
10+ const evt = { } ;
11+ const wrapper = shallow (
12+ < GoodBye
13+ when
14+ alertBeforeUnload
15+ alertMessage = { fakeMsg }
16+ children = { childFunction }
17+ />
18+ ) ;
19+ expect ( wrapper . instance ( ) . handleBeforeUnload ( evt ) ) . toBe ( fakeMsg ) ;
20+ expect ( evt . returnValue ) . toBe ( fakeMsg ) ;
21+ } ) ;
22+ } )
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { shallow } from 'enzyme' ;
3- import GoodBye , { Provider , withGoodBye } from '../src' ;
3+ import { Provider } from '../src' ;
44
55describe ( '<Provider />' , ( ) => {
66 test ( 'should receive handleGetUserConfirm render prop' , ( ) => {
You can’t perform that action at this time.
0 commit comments