diff --git a/__mocks__/react-i18next.ts b/__mocks__/react-i18next.ts new file mode 100644 index 0000000..1dc4854 --- /dev/null +++ b/__mocks__/react-i18next.ts @@ -0,0 +1,9 @@ +import localeRu from '../locales/ru.json'; + +module.exports = { + useTranslation: (_, { keyPrefix }) => { + return { + t: (key: string) => localeRu[`${keyPrefix}.${key}`], + }; + } +}; diff --git a/tests/example.spec.ts b/e2e/example.spec.ts similarity index 100% rename from tests/example.spec.ts rename to e2e/example.spec.ts diff --git a/jest-preset-it/jest-preset.ts b/jest-preset-it/jest-preset.ts index b633b57..53e9cb0 100644 --- a/jest-preset-it/jest-preset.ts +++ b/jest-preset-it/jest-preset.ts @@ -9,9 +9,11 @@ module.exports = { clearMocks: true, moduleNameMapper: { '\\.(svg|webp)$': '/__mocks__/file', + 'react-i18next': '/__mocks__/react-i18next', }, testEnvironmentOptions: { customExportConditions: [''], }, testEnvironment: 'jest-fixed-jsdom', + testPathIgnorePatterns: ['/node_modules/', '/e2e'], }; diff --git a/src/__data__/service/api.ts b/src/__data__/service/api.ts index 962a0f4..86adbfa 100644 --- a/src/__data__/service/api.ts +++ b/src/__data__/service/api.ts @@ -16,7 +16,9 @@ type UpdateOrderProps = Required> & export const api = createApi({ reducerPath: 'api', - baseQuery: fetchBaseQuery({ baseUrl: getConfigValue('dry-wash.api') }), + baseQuery: fetchBaseQuery({ + baseUrl: new URL(getConfigValue('dry-wash.api'), location.origin).href, + }), tagTypes: ['Masters', 'Orders'], endpoints: (builder) => ({ getMasters: builder.query({ diff --git a/src/pages/__tests__/__snapshots__/arm.test.tsx.snap b/src/pages/__tests__/__snapshots__/arm.test.tsx.snap index 62efc6d..f8291d5 100644 --- a/src/pages/__tests__/__snapshots__/arm.test.tsx.snap +++ b/src/pages/__tests__/__snapshots__/arm.test.tsx.snap @@ -6,58 +6,58 @@ exports[`Arm Page render 1`] = ` class="css-1yeiifd" >

- title + Заказы

- 2/2/2025 + 09.02.2025

@@ -140,11 +140,11 @@ exports[`Arm Page render 1`] = ` class="css-0" >
- table.header.carNumber + Номер машины - table.header.orderDate + Дата заказа - table.header.status + Статус - table.header.masters + Мастер - table.header.telephone + Телефон - table.header.location + Расположение
+