From 8ee736f278ce732df10bc137456969cf6e910774 Mon Sep 17 00:00:00 2001 From: mohammad Date: Wed, 25 Oct 2023 13:11:15 +0330 Subject: [PATCH] CFE-1 complete test of all parts of callHistory part of Call Widget --- public/locales/fa/app.json | 3 ++- .../HistoryHeader/__tests__/index.test.js | 2 +- .../__tests__/index.test.js | 22 +++++++++++++++++++ .../index.jsx | 4 ++-- .../Topics/__tests__/index.test.js | 22 +++++++++++++++++++ .../ListItemOfCalls/__tests__/index.test.js | 0 .../CallHistory/ListItemOfCalls/index.jsx | 4 ++-- .../CallHistory/LoadingHistory/index.jsx | 2 +- .../CallHistory/__tests__/index.test.js | 8 ------- .../CallTabPanel/CallHistory/index.jsx | 2 +- 10 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/__tests__/index.test.js rename src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/{PreviusOperatorData => PreviousOperatorData}/index.jsx (91%) create mode 100644 src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/Topics/__tests__/index.test.js delete mode 100644 src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/__tests__/index.test.js delete mode 100644 src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/__tests__/index.test.js diff --git a/public/locales/fa/app.json b/public/locales/fa/app.json index 4ae635f..0a1c31b 100644 --- a/public/locales/fa/app.json +++ b/public/locales/fa/app.json @@ -258,6 +258,7 @@ "date": "تاریخ", "call_history_of": "تاریخچه تماس های", "call_history_not_found": "تاریخچه ای برای تماس دریافتی یافت نشد", - "call_history_error_fetching": "خطا در دریافت تاریخچه تماس دریافتی" + "call_history_error_fetching": "خطا در دریافت تاریخچه تماس دریافتی", + "show_more": "نمایش موارد بیشتر" } } diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/HistoryHeader/__tests__/index.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/HistoryHeader/__tests__/index.test.js index 13e05cf..51d700e 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/HistoryHeader/__tests__/index.test.js +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/HistoryHeader/__tests__/index.test.js @@ -12,7 +12,7 @@ describe("HistoryHeader Component From call history", () => { const textHeader = screen.queryByText(/تاریخچه تماس های/i); expect(textHeader).toBeInTheDocument(); }); - it("number of caller in header rendered", () => { + it("caller number in header rendered", () => { render(); const callerNumber = screen.queryByText(/09111111111/i); expect(callerNumber).toBeInTheDocument(); diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/__tests__/index.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/__tests__/index.test.js new file mode 100644 index 0000000..4fd4519 --- /dev/null +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/__tests__/index.test.js @@ -0,0 +1,22 @@ +import {render, screen} from "@testing-library/react"; +import MockAppWithProviders from "../../../../../../../../../../../../mocks/AppWithProvider"; +import PreviousOperatorData from "../../PreviousOperatorData"; + +describe("PreviousOperatorData Component From call history", () => { + describe("Rendering", () => { + const historyItem = { + operator_name: "test name", + answer_date: "test date" + } + it("operator name rendered", () => { + render(); + const operatorName = screen.queryByText("test name"); + expect(operatorName).toBeInTheDocument(); + }); + it("operator answer date rendered", () => { + render(); + const operatorAnswerDate = screen.queryByText("test date"); + expect(operatorAnswerDate).toBeInTheDocument(); + }); + }); +}); \ No newline at end of file diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviusOperatorData/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/index.jsx similarity index 91% rename from src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviusOperatorData/index.jsx rename to src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/index.jsx index a907a33..afd2ad7 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviusOperatorData/index.jsx +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/PreviousOperatorData/index.jsx @@ -2,7 +2,7 @@ import {useTranslations} from "next-intl"; import {Avatar, Box, ListItem, ListItemAvatar, ListItemText, Typography} from "@mui/material"; import HeadsetMicIcon from '@mui/icons-material/HeadsetMic'; -const PreviusOperatorData = ({historyItem}) => { +const PreviousOperatorData = ({historyItem}) => { const t = useTranslations(); return ( @@ -25,4 +25,4 @@ const PreviusOperatorData = ({historyItem}) => { ) } -export default PreviusOperatorData +export default PreviousOperatorData diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/Topics/__tests__/index.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/Topics/__tests__/index.test.js new file mode 100644 index 0000000..d9d77e4 --- /dev/null +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/Topics/__tests__/index.test.js @@ -0,0 +1,22 @@ +import {render, screen} from "@testing-library/react"; +import MockAppWithProviders from "../../../../../../../../../../../../mocks/AppWithProvider"; +import Topics from "../../Topics"; + +describe("Topics Component From call history", () => { + describe("Rendering", () => { + const historyItem = { + category_name: "test category", + subcategory_name: "test sub category" + } + it("operator name rendered", () => { + render(); + const operatorName = screen.queryByText("test category"); + expect(operatorName).toBeInTheDocument(); + }); + it("operator answer date rendered", () => { + render(); + const operatorAnswerDate = screen.queryByText("test sub category"); + expect(operatorAnswerDate).toBeInTheDocument(); + }); + }); +}); \ No newline at end of file diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/__tests__/index.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/__tests__/index.test.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/index.jsx index d697da8..7af4fd5 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/index.jsx +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/ListItemOfCalls/index.jsx @@ -1,6 +1,6 @@ import {useTranslations} from "next-intl"; import {Grow, List} from "@mui/material"; -import PreviusOperatorData from "./PreviusOperatorData"; +import PreviousOperatorData from "./PreviousOperatorData"; import Topics from "./Topics"; const ListItemOfCalls = ({historyItem}) => { @@ -11,7 +11,7 @@ const ListItemOfCalls = ({historyItem}) => { return ( - + diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/LoadingHistory/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/LoadingHistory/index.jsx index 79093cb..2c9900e 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/LoadingHistory/index.jsx +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/LoadingHistory/index.jsx @@ -39,7 +39,7 @@ const LoadingHistory = () => { /> }/> - + diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/__tests__/index.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/__tests__/index.test.js deleted file mode 100644 index 2e107ed..0000000 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/__tests__/index.test.js +++ /dev/null @@ -1,8 +0,0 @@ -describe("CreateForm Component From Expert Management", () => { - describe("Rendering", () => { - - }); - describe("Behavioral", () => { - - }); -}); \ No newline at end of file diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/index.jsx index dd9f44a..c83bc49 100644 --- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/index.jsx +++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabPanel/CallHistory/index.jsx @@ -40,7 +40,7 @@ const CallHistory = ({tab}) => { } onClick={() => setShowRestOfHistory(true)} - label="نمایش موارد بیشتر" + label={t("show_more")} disabled={showRestOfHistory} />