Skip to content

Commit

Permalink
[RNMobile] Mock switch component to address a warning when running te…
Browse files Browse the repository at this point in the history
…sts (#32963)
  • Loading branch information
fluiddot committed Jul 2, 2021
1 parent 8a520e9 commit 180abaf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/native/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ jest.mock(
} ) ),
} )
);

// Silences the warning: dispatchCommand was called with a ref that isn't a native
// component. Use React.forwardRef to get access to the underlying native component.
// This is a known bug of react-native-testing-library package:
// https://github.com/callstack/react-native-testing-library/issues/329#issuecomment-737307473
jest.mock( 'react-native/Libraries/Components/Switch/Switch', () => {
const jestMockComponent = require( 'react-native/jest/mockComponent' );
return jestMockComponent(
'react-native/Libraries/Components/Switch/Switch'
);
} );

0 comments on commit 180abaf

Please sign in to comment.