From 909cbd032181ea781f5fff9da07b19390712796a Mon Sep 17 00:00:00 2001 From: RustamRu Date: Wed, 12 Mar 2025 01:49:44 +0300 Subject: [PATCH] feat: Add new features and mock data for order and configuration testing - Updated brojs-cli mock to include additional feature flags - Modified Jest preset to exclude more files from coverage - Updated snapshot tests for masters, order create, order view, and orders list pages - Added new UI elements and interactions in various components - Improved test coverage configuration --- __mocks__/brojs-cli-mock.ts | 4 +- jest-preset-it/jest-preset.ts | 2 +- .../__snapshots__/masters.test.tsx.snap | 62 ++-- .../__snapshots__/order-create.test.tsx.snap | 282 ++++++++++++------ .../__snapshots__/order-view.test.tsx.snap | 119 +++++++- .../__snapshots__/ordersList.test.tsx.snap | 228 +++++++++++--- 6 files changed, 514 insertions(+), 183 deletions(-) diff --git a/__mocks__/brojs-cli-mock.ts b/__mocks__/brojs-cli-mock.ts index c294243..eedac3a 100644 --- a/__mocks__/brojs-cli-mock.ts +++ b/__mocks__/brojs-cli-mock.ts @@ -3,7 +3,9 @@ import { jest } from '@jest/globals'; jest.mock('@brojs/cli', () => ({ getConfigValue: jest.fn(() => '/api'), getFeatures: jest.fn(() => ({ - ['order-view-status-polling']: { value: '3000' } + ['order-view-status-polling']: { value: '3000' }, + ['car-img-upload']: { value: 'true' }, + ['order-cost']: { value: '1000' }, })), getNavigationValue: jest.fn((navKey: string) => { switch (navKey) { diff --git a/jest-preset-it/jest-preset.ts b/jest-preset-it/jest-preset.ts index 67a91bc..cd088fc 100644 --- a/jest-preset-it/jest-preset.ts +++ b/jest-preset-it/jest-preset.ts @@ -5,7 +5,7 @@ module.exports = { }, coverageProvider: 'v8', coverageDirectory: 'coverage', - collectCoverageFrom: ['**/src/**/*.{ts,tsx}', '!**/src/app.tsx'], + collectCoverageFrom: ['**/src/**/*.{ts,tsx}', '!**/src/app.tsx', '!**/src/**/types.ts', '!**/src/**/*.d.ts', '!**/src/models/**/*'], collectCoverage: true, clearMocks: true, moduleNameMapper: { diff --git a/src/pages/__tests__/__snapshots__/masters.test.tsx.snap b/src/pages/__tests__/__snapshots__/masters.test.tsx.snap index fc26ae6..95d72e4 100644 --- a/src/pages/__tests__/__snapshots__/masters.test.tsx.snap +++ b/src/pages/__tests__/__snapshots__/masters.test.tsx.snap @@ -3,46 +3,42 @@ exports[`Master Page should display master list and show details when master button is clicked 1`] = `
- +
diff --git a/src/pages/__tests__/__snapshots__/order-create.test.tsx.snap b/src/pages/__tests__/__snapshots__/order-create.test.tsx.snap index 71fe73b..87b781b 100644 --- a/src/pages/__tests__/__snapshots__/order-create.test.tsx.snap +++ b/src/pages/__tests__/__snapshots__/order-create.test.tsx.snap @@ -90,65 +90,163 @@ exports[`Create Order page renders page structure 1`] = ` > Цвет автомобиля - - - - - - - - - - - + + + + + + + + + +
+
Тип кузова автомобиля