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

Recoil-Sync syncEffect Jest error #2307

@SocDario

Description

@SocDario

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions