diff --git a/config/jest/jest.config.ts b/config/jest/jest.config.ts index c91ece3..b48f59b 100644 --- a/config/jest/jest.config.ts +++ b/config/jest/jest.config.ts @@ -22,6 +22,7 @@ export default { '\\.s?css$': 'identity-obj-proxy', '\\.svg': path.resolve(__dirname, 'jestEmptyComponent.tsx'), }, + transformIgnorePatterns: ['/node_modules/(?!axios)'], // Indicates whether the coverage information should be collected while executing the test // collectCoverage: false, diff --git a/src/features/AuthByUsername/model/services/loginByUsername/loginByUsername.test.ts b/src/features/AuthByUsername/model/services/loginByUsername/loginByUsername.test.ts index e69de29..23c1249 100644 --- a/src/features/AuthByUsername/model/services/loginByUsername/loginByUsername.test.ts +++ b/src/features/AuthByUsername/model/services/loginByUsername/loginByUsername.test.ts @@ -0,0 +1,5 @@ +describe('loginByUsername.test', () => { + test('test', () => { + expect(1).toBe(1); + }); +}); diff --git a/src/shared/config/i18n/i18nForTests.ts b/src/shared/config/i18n/i18nForTests.ts index 75682db..576d49f 100644 --- a/src/shared/config/i18n/i18nForTests.ts +++ b/src/shared/config/i18n/i18nForTests.ts @@ -9,6 +9,7 @@ i18n.use(initReactI18next).init({ interpolation: { escapeValue: false, // not needed for react!! }, + react: { useSuspense: false }, resources: { ru: { translations: {} } }, }); diff --git a/src/shared/lib/tests/componentRender/componentRender.tsx b/src/shared/lib/tests/componentRender/componentRender.tsx index 1da1958..364961a 100644 --- a/src/shared/lib/tests/componentRender/componentRender.tsx +++ b/src/shared/lib/tests/componentRender/componentRender.tsx @@ -2,7 +2,7 @@ import type { DeepPartial } from '@reduxjs/toolkit'; import { render } from '@testing-library/react'; import type { StateSchema } from 'app/providers/StoreProvider'; import { StoreProvider } from 'app/providers/StoreProvider'; -import type { ReactNode } from 'react'; +import { Suspense, type ReactNode } from 'react'; import { I18nextProvider } from 'react-i18next'; import { MemoryRouter } from 'react-router-dom'; import i18nForTests from 'shared/config/i18n/i18nForTests'; @@ -17,9 +17,11 @@ export function componentRender(component: ReactNode, options: componentRenderOp return render( - - {component} - + + + {component} + + , ); } diff --git a/src/widgets/Sidebar/ui/Sidebar/Sidebar.test.tsx b/src/widgets/Sidebar/ui/Sidebar/Sidebar.test.tsx index 0c7260a..492d8b4 100644 --- a/src/widgets/Sidebar/ui/Sidebar/Sidebar.test.tsx +++ b/src/widgets/Sidebar/ui/Sidebar/Sidebar.test.tsx @@ -1,15 +1,17 @@ import { fireEvent, screen } from '@testing-library/react'; -import { Sidebar } from 'widgets/Sidebar/ui/Sidebar/Sidebar'; import { componentRender } from 'shared/lib/tests/componentRender/componentRender'; +import { Sidebar } from 'widgets/Sidebar/ui/Sidebar/Sidebar'; describe('Sidebar', () => { - test('with only first param', () => { + beforeEach(() => { componentRender(); + }); + + test('with only first param', () => { expect(screen.getByTestId('sidebar')).toBeInTheDocument(); }); test('test toggle', () => { - componentRender(); const toggleBtn = screen.getByTestId('sidebar-toggle'); expect(screen.getByTestId('sidebar')).toBeInTheDocument(); fireEvent.click(toggleBtn);