When importing CookieManager into tests we get the following error:
import { NativeModules, Platform } from 'react-native';
^^^^^^
SyntaxError: Cannot use import statement outside a module
1 | import { ApolloClient, ApolloProvider } from '@apollo/client'
> 2 | import CookieManager from '@react-native-cookies/cookies'
For others who have this issue, we worked around it in our tests by mocking the entire library like this:
// __mocks__/@react-native-cookies/cookies.ts
const CookieManager = {
clearAll: jest.fn(),
// Any other methods you need
}
export default CookieManager
When importing CookieManager into tests we get the following error:
For others who have this issue, we worked around it in our tests by mocking the entire library like this: