Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wallet] fix missing full name error alert #1496

Merged
merged 1 commit into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/mobile/locales/en-US/nuxVerification2.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"country": "Country",
"phoneNumber": "Phone Number",
"invalidPhone": "Invalid Phone Number",
"missingFullName": "Please enter full name",
"allowSmsPermissions": "Allow Celo Wallet to send and view SMS messages",
"dontAsk": "Don't ask again",
"deny": "Deny",
Expand Down
1 change: 1 addition & 0 deletions packages/mobile/locales/es-419/nuxVerification2.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"country": "País",
"phoneNumber": "Número de teléfono",
"invalidPhone": "Número de teléfono inválido",
"missingFullName": "Por favor ingresa tu nombre completo",
"allowSmsPermissions": "Permitir que el Monedero Celo envíe y vea mensajes de texto (SMS)",
"dontAsk": "No volver a preguntar",
"deny": "Denegar",
Expand Down
1 change: 1 addition & 0 deletions packages/mobile/src/app/ErrorMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum ErrorMessages {
IMPORT_BACKUP_FAILED = 'backupKeyFlow6:importBackupFailed',
BACKUP_QUIZ_FAILED = 'backupKeyFlow6:backupQuizFailed',
INVALID_PHONE_NUMBER = 'nuxVerification2:invalidPhone',
MISSING_FULL_NAME = 'nuxVerification2:missingFullName',
NOT_READY_FOR_CODE = 'nuxVerification2:notReadyForCode',
EMPTY_ATTESTATION_CODE = 'nuxVerification2:emptyVerificationCode',
INVALID_ATTESTATION_CODE = 'nuxVerification2:invalidVerificationCode',
Expand Down
24 changes: 24 additions & 0 deletions packages/mobile/src/invite/JoinCelo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ describe('JoinCeloScreen', () => {
expect(tree).toMatchSnapshot()
})

it('show missing full name warning', () => {
const showErrorMock = jest.fn()
const store = createMockStore()
const wrapper = render(
<Provider store={store}>
<JoinCeloClass
showError={showErrorMock}
hideAlert={jest.fn()}
setPhoneNumber={jest.fn()}
setName={jest.fn()}
language={'en-us'}
cachedName={''}
cachedNumber={''}
cachedCountryCode={'+1'}
pincodeType={PincodeType.Unset}
{...getMockI18nProps()}
/>
</Provider>
)
fireEvent.changeText(wrapper.getByTestId('PhoneNumberField'), '4155556666')
fireEvent.press(wrapper.getByTestId('JoinCeloContinueButton'))
expect(showErrorMock.mock.calls[0][0]).toBe(ErrorMessages.MISSING_FULL_NAME)
})

it('is disabled with no text', () => {
const wrapper = render(
<Provider store={createMockStore()}>
Expand Down
7 changes: 6 additions & 1 deletion packages/mobile/src/invite/JoinCelo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ export class JoinCelo extends React.Component<Props, State> {
return
}

if (!name || !e164Number || !isValidNumber || !countryCode) {
if (!e164Number || !isValidNumber || !countryCode) {
this.props.showError(ErrorMessages.INVALID_PHONE_NUMBER)
return
}

if (!name) {
this.props.showError(ErrorMessages.MISSING_FULL_NAME)
return
}

this.props.setPhoneNumber(e164Number, countryCode)
this.props.setName(name)
this.goToNextScreen()
Expand Down