@@ -10,12 +10,11 @@ Keyboard.dismiss = jest.fn()
10
10
describe ( '<OtpInputs />' , ( ) => {
11
11
const wrapper = renderer . create ( < OtpInputs /> )
12
12
13
- test ( 'render' , done => {
13
+ test ( 'render' , ( ) => {
14
14
expect ( wrapper . toJSON ( ) ) . toMatchSnapshot ( )
15
15
expect ( wrapper . root . findAllByType ( OtpInput ) . length ) . toEqual ( 4 )
16
16
const sixInputsWrapper = renderer . create ( < OtpInputs numberOfInputs = { 6 } /> )
17
17
expect ( sixInputsWrapper . root . findAllByType ( OtpInput ) . length ) . toEqual ( 6 )
18
- done ( )
19
18
} )
20
19
21
20
test ( 'rendering with error' , ( ) => {
@@ -136,21 +135,25 @@ describe('<OtpInputs />', () => {
136
135
describe ( 'OtpInput events' , ( ) => {
137
136
const wrapper = renderer . create ( < OtpInputs /> )
138
137
139
- describe ( 'handleBackspace' , ( ) => {
140
- const wrapperInstance = wrapper . getInstance ( )
141
- wrapperInstance . _handleBackspace = jest . fn ( )
142
- const OtpInputComponent = wrapper . root . findAllByType ( OtpInput ) [ 0 ]
138
+ describe ( '_handleBackspace' , ( ) => {
139
+ test ( 'should call handleBaspace function when OtpInput calls it' , ( ) => {
140
+ const wrapperInstance = wrapper . getInstance ( )
141
+ wrapperInstance . _handleBackspace = jest . fn ( )
142
+ const OtpInputComponent = wrapper . root . findAllByType ( OtpInput ) [ 0 ]
143
143
144
- OtpInputComponent . props . handleBackspace ( )
145
- expect ( wrapperInstance . _handleBackspace ) . toBeCalled ( )
144
+ OtpInputComponent . props . handleBackspace ( )
145
+ expect ( wrapperInstance . _handleBackspace ) . toBeCalled ( )
146
+ } )
146
147
} )
147
148
148
149
describe ( 'updateText' , ( ) => {
149
- const wrapperInstance = wrapper . getInstance ( )
150
- wrapperInstance . _updateText = jest . fn ( )
151
- const OtpInputComponent = wrapper . root . findAllByType ( OtpInput ) [ 0 ]
150
+ test ( 'should call updateText function when OtpInput calls it' , ( ) => {
151
+ const wrapperInstance = wrapper . getInstance ( )
152
+ wrapperInstance . _updateText = jest . fn ( )
153
+ const OtpInputComponent = wrapper . root . findAllByType ( OtpInput ) [ 0 ]
152
154
153
- OtpInputComponent . props . updateText ( )
154
- expect ( wrapperInstance . _updateText ) . toBeCalled ( )
155
+ OtpInputComponent . props . updateText ( )
156
+ expect ( wrapperInstance . _updateText ) . toBeCalled ( )
157
+ } )
155
158
} )
156
159
} )
0 commit comments