Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Recoil-Sync syncEffect Jest error #2307

Open
SocDario opened this issue Feb 26, 2024 · 0 comments
Open

Recoil-Sync syncEffect Jest error #2307

SocDario opened this issue Feb 26, 2024 · 0 comments

Comments

@SocDario
Copy link

SocDario commented Feb 26, 2024

Hello,

I am facing an issue with testing recoil-sync with Jest. It's about default test generated along with React Native.

Versions:

"recoil": "0.7.7",
"recoil-sync": "0.2.0",
"jest": "29.2.1",
"@recoiljs/refine": "0.1.1"

Below is a test file of creating App component:

/**
 * @format
 */
// Note: import explicitly to use the types shiped with jest.
import { it } from '@jest/globals';
import 'react-native';
import React from 'react';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

import App from '../App';

it('renders correctly', () => {
  renderer.create(<App />);
});

Getting the following error on running test:

FAIL  __tests__/App.test.tsx
  ● Test suite failed to run

    TypeError: (0 , _recoilSync.syncEffect) is not a function

      10 |   default: undefined,
      11 |   effects: [
    > 12 |     syncEffect({
         |               ^
      13 |       storeKey: Storage.AsyncStorage,
      14 |       refine: nullable(
      15 |         object({

      at Object.<anonymous> (src/modules/authentication/state/atoms.ts:12:15)
      at Object.require (src/modules/authentication/state/index.ts:1:1)
      at Object.require (src/modules/authentication/index.ts:1:1)
      at Object.require (src/modules/apollo-client/hooks/useApolloClientSetup.ts:15:1)
      at Object.require (src/modules/apollo-client/hooks/index.ts:1:1)
      at Object.require (src/modules/apollo-client/components/ApolloClientProvider.tsx:4:1)
      at Object.require (src/modules/apollo-client/components/index.ts:1:1)
      at Object.require (src/modules/apollo-client/index.ts:1:1)
      at Object.require (App.tsx:8:1)
      at Object.require (__tests__/App.test.tsx:12:1)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant