From 6bca7c32e0853dee7ad852788885e2a8b9a318ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Volpe?= Date: Tue, 12 Nov 2019 15:27:34 +0100 Subject: [PATCH] [wallet] Fixed Native phone picker Use native API instead (#1669) --- .../components/PhoneNumberInput.test.tsx | 10 ++++------ .../react-components/components/PhoneNumberInput.tsx | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/react-components/components/PhoneNumberInput.test.tsx b/packages/react-components/components/PhoneNumberInput.test.tsx index 81c02acd7b9..97a8872544f 100644 --- a/packages/react-components/components/PhoneNumberInput.test.tsx +++ b/packages/react-components/components/PhoneNumberInput.test.tsx @@ -1,6 +1,7 @@ import PhoneNumberInput from '@celo/react-components/components/PhoneNumberInput' import { shallow } from 'enzyme' import * as React from 'react' +import { Platform } from 'react-native' import { fireEvent, render } from 'react-native-testing-library' jest.mock('@celo/react-native-sms-retriever', () => { @@ -9,12 +10,6 @@ jest.mock('@celo/react-native-sms-retriever', () => { } }) -jest.mock('react-native-device-info', () => { - return { - getBaseOs: jest.fn(() => 'Android'), - } -}) - describe('PhoneNumberInput', () => { describe('when defaultCountry is falsy', () => { it('renders an AutoComplete and a country can be selected', () => { @@ -54,6 +49,9 @@ describe('when defaultCountry is truthy', () => { describe('Native phone picker (Android)', () => { it('can read phone', async () => { + // mock + Platform.OS = 'android' + const wrapper = shallow( { async triggerPhoneNumberRequest() { try { - const baseOS = await DeviceInfo.getBaseOs() - if (baseOS === 'Android') { + if (Platform.OS === 'android') { await this.triggerPhoneNumberRequestAndroid() } else { console.info(`${TAG}/triggerPhoneNumberRequest`, 'Not implemented in this platform')