From a616d3815bc5912257f38a9c08a09f9cfafd4930 Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sun, 16 Feb 2025 11:31:26 +0300 Subject: [PATCH] feat: add master test --- e2e/example.spec.ts | 2 +- src/__data__/service/utils.ts | 14 +- ...test.tsx.snap => ordersList.test.tsx.snap} | 171 +----------------- src/pages/__tests__/masters.test.tsx | 98 ++++++++++ .../{arm.test.tsx => ordersList.test.tsx} | 8 +- 5 files changed, 115 insertions(+), 178 deletions(-) rename src/pages/__tests__/__snapshots__/{arm.test.tsx.snap => ordersList.test.tsx.snap} (76%) create mode 100644 src/pages/__tests__/masters.test.tsx rename src/pages/__tests__/{arm.test.tsx => ordersList.test.tsx} (96%) diff --git a/e2e/example.spec.ts b/e2e/example.spec.ts index 114f1bf..8b20958 100644 --- a/e2e/example.spec.ts +++ b/e2e/example.spec.ts @@ -6,7 +6,7 @@ test.beforeEach('check server is up', async ({ page }) => { const makeOrderText = page.getByText('Сделать заказ', { exact: true }); await expect(makeOrderText).toBeVisible(); } catch (error) { - console.error('server not up'); + console.error('server not up', error); test.skip(); } }); diff --git a/src/__data__/service/utils.ts b/src/__data__/service/utils.ts index 0f7d325..2ffe971 100644 --- a/src/__data__/service/utils.ts +++ b/src/__data__/service/utils.ts @@ -1,6 +1,6 @@ -import { FetchBaseQueryError } from "@reduxjs/toolkit/query"; +import { FetchBaseQueryError } from '@reduxjs/toolkit/query'; -import { BaseResponse } from "../../models/api"; +import { BaseResponse } from '../../models/api'; export const extractBodyFromResponse =
(response: BaseResponse) => { if (response.success) { @@ -8,8 +8,14 @@ export const extractBodyFromResponse = (response: BaseResponse) => { } }; -export const extractErrorMessageFromResponse = ({ data }: FetchBaseQueryError) => { - if (typeof data === 'object' && 'message' in data && typeof data.message === 'string') { +export const extractErrorMessageFromResponse = ({ + data, +}: FetchBaseQueryError) => { + if ( + typeof data === 'object' && + 'message' in data && + typeof data.message === 'string' + ) { return data.message; } }; diff --git a/src/pages/__tests__/__snapshots__/arm.test.tsx.snap b/src/pages/__tests__/__snapshots__/ordersList.test.tsx.snap similarity index 76% rename from src/pages/__tests__/__snapshots__/arm.test.tsx.snap rename to src/pages/__tests__/__snapshots__/ordersList.test.tsx.snap index f8291d5..9d00846 100644 --- a/src/pages/__tests__/__snapshots__/arm.test.tsx.snap +++ b/src/pages/__tests__/__snapshots__/ordersList.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Arm Page render 1`] = ` +exports[`order page получение списка заказов 1`] = ` -- Номер машины - | -- Дата заказа - | -- Статус - | -- Мастер - | -- Телефон - | -- Расположение - | -
---|---|---|---|---|---|
-
-
- Loading...
-
-
- |
-
- 09.02.2025 + 2/16/2025