sentry-react-native
sentry-react-native copied to clipboard
Refactor test to minimally depende on JS SDK internals
Description
Currently, we use a lot of mocked classes and we depend on the internal structure of the JS SDK, this leads to several tests breaking when we upgrade to a newer JS SDK.
-
This should not happen unintentionally, if the test intention was to test RN SDK implementation it should not depend on JS internals.
-
In cases where the JS SDK internal is crucial to RN SDK and its change would break RN we should add a separate test.
Example of tests to change:
- Should not mock the Hub and Scope https://github.com/getsentry/sentry-react-native/blob/27ab160fa88e6e13afd218176946e60291cff1a4/test/tracing/gesturetracing.test.ts#L31-L70
- The same https://github.com/getsentry/sentry-react-native/blob/27ab160fa88e6e13afd218176946e60291cff1a4/test/tracing/reactnativetracing.test.ts#L56-L102