import * as React from 'react' ; import { createTestComponent } from '@client/tests/util' ; import { SecureAccount } from '@client/views/SecureAccount/SecureAccountView' ; import { createStore } from '@client/store' ; import { ReactWrapper } from 'enzyme' ; describe ( 'Login app > Secure Account Page' , ( ) => { let component ; beforeEach ( async ( ) => { const { store } = createStore ( ) ; const testComponent = await createTestComponent ( < SecureAccount onComplete = { ( ) => null } />, store); component = testComponent . component ; } ) ; it ( 'Renders the secure account page successfully' , ( ) => { const elem = component . find ( '#createPinBtn' ) . hostNodes ( ) ; expect ( elem ) . toHaveLength ( 1 ) ; } ) ; it ( 'Create pin button click takes user to create pin screen' , async ( ) => { component . find ( '#createPinBtn' ) . hostNodes ( ) . simulate ( 'click' ) ; await new Promise ( ( resolve ) => { setTimeout ( ( ) => { resolve ( ) ; } , 50 ) ; } ) ; component . update ( ) ; expect ( component . find ( '#keypad-1' ) . hostNodes ( ) ) . toHaveLength ( 1 ) ; } ) ; } ) ;