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')