Simplify bridge types

Summary: This turns the bridge type into a simpler struct with always-present methods so you don't need to add additional null check to the calling logic which are hard to deal with.

Reviewed By: mweststrate

Differential Revision: D30248628

fbshipit-source-id: cdaee44efcbb19dcbb301099b4a7d0eb0c350e67
This commit is contained in:
Pascal Hartig
2021-08-11 11:02:10 -07:00
committed by Facebook GitHub Bot
parent 52b3edc5ad
commit 757ba91bf6
5 changed files with 67 additions and 51 deletions

View File

@@ -14,6 +14,7 @@ import {
import configureStore from 'redux-mock-store';
import {State, createRootReducer} from '../../reducers/index';
import {getInstance} from '../../fb-stubs/Logger';
import {IOSBridge} from '../../utils/IOSBridge';
const mockStore = configureStore<State, {}>([])(
createRootReducer()(undefined, {type: 'INIT'}),
@@ -64,9 +65,7 @@ test('test getAllPromisesForQueryingDevices when xcode detected', () => {
const promises = getAllPromisesForQueryingDevices(
mockStore,
logger,
{
idbAvailable: false,
},
{} as IOSBridge,
true,
);
expect(promises.length).toEqual(3);
@@ -76,9 +75,7 @@ test('test getAllPromisesForQueryingDevices when xcode is not detected', () => {
const promises = getAllPromisesForQueryingDevices(
mockStore,
logger,
{
idbAvailable: true,
},
{} as IOSBridge,
false,
);
expect(promises.length).toEqual(1);