This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import TestRenderer from 'react-test-renderer'; | |
| import CognitoLogin from './CognitoLogin'; | |
| import _ from 'lodash'; | |
| it('When no `code` or `email` `onSavePress` should set `message` to `Need code and user e-mail`', async (done) => { | |
| // Arrange | |
| const wrapper = TestRenderer.create(<CognitoLogin />); | |
| const child = wrapper.root.findByProps({ | |
| testID: 'ForgotForm', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class CognitoLogin extends React.Component< | |
| ICognitoLoginProps, | |
| ICognitoLoginState | |
| > { | |
| constructor(props: ICognitoLoginProps) { | |
| super(props); | |
| this.state = { | |
| userInput: __DEV__ | |
| ? { | |
| email: 'cogtest@mailinator.com', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('`onEmailChanged` should update state', () => { | |
| const wrapper = TestRenderer.create(<CognitoLogin />); | |
| const expectedEmail = 'bogus@stuff.com'; | |
| wrapper.root.instance.onEmailChanged(expectedEmail); | |
| expect(wrapper.root.instance.state.userInput.email).toBe(expectedEmail); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('Error label should contain `No userPool`', async () => { | |
| const wrapper = TestRenderer.create(<CognitoLogin />); | |
| const child = wrapper.root.findByProps({ iconName: 'sign-in' }); | |
| await child.props.onPress(); | |
| const errorLabel = wrapper.root.findByProps({ isCaption: true }); | |
| expect(errorLabel.props.children).toBe('No userPool'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Auth } from 'aws-amplify'; | |
| import GetJwtToken from './GetJwtToken'; | |
| describe('jwt', () => { | |
| describe('GetJwtToken', () => { | |
| it('Original mock for Auth class', async () => { | |
| const result: Error = (await GetJwtToken()) as Error; | |
| expect(result.message).toBe('Could not get session'); | |
| }); |
OlderNewer