diff --git a/frontend/src/Pages/GiftRecommendPage.test.tsx b/frontend/src/Pages/GiftRecommendPage.test.tsx
index bdf86ce..ca022c7 100644
--- a/frontend/src/Pages/GiftRecommendPage.test.tsx
+++ b/frontend/src/Pages/GiftRecommendPage.test.tsx
@@ -1,4 +1,5 @@
import { fireEvent, render, screen } from "@testing-library/react"
+import axios from "axios";
import { Provider } from "react-redux";
import { MemoryRouter, Route, Routes } from "react-router";
import { GiftState } from "../store/slices/gift";
@@ -103,7 +104,31 @@ describe("", () => {
)
});
it("should render GiftRecommendPage", async () => {
+ axios.post = jest.fn().mockResolvedValue({ data: ["keyword1", "keyword2"] });
const { container } = render(giftRecommendPage);
expect(container).toBeTruthy()
+ fireEvent.click(screen.queryByText(/^10대 남성$/i)!)
+ fireEvent.click(screen.queryByText(/^20대 남성$/i)!)
+ fireEvent.click(screen.queryByText(/^30대 남성$/i)!)
+ fireEvent.click(screen.queryByText(/^10대 여성$/i)!)
+ fireEvent.click(screen.queryByText(/^20대 여성$/i)!)
+ fireEvent.click(screen.queryByText(/^30대 여성$/i)!)
+
+ fireEvent.click(screen.queryByText(/^전품목$/i)!)
+ fireEvent.click(screen.queryByText(/^패션의류$/i)!)
+ fireEvent.click(screen.queryByText(/^패션잡화$/i)!)
+ fireEvent.click(screen.queryByText(/^화장품미용$/i)!)
+ fireEvent.click(screen.queryByText(/^디지털가전$/i)!)
+ fireEvent.click(screen.queryByText(/^가구인테리어$/i)!)
+ fireEvent.click(screen.queryByText(/^식품$/i)!)
+ fireEvent.click(screen.queryByText(/^스포츠레저$/i)!)
+ fireEvent.click(screen.queryByText(/^생활건강$/i)!)
+ fireEvent.click(screen.queryByText(/^여가생활편의$/i)!)
+
+ fireEvent.click(screen.queryByText(/^~3만원$/i)!)
+ fireEvent.click(screen.queryByText(/^3만원~5만원$/i)!)
+ fireEvent.click(screen.queryByText(/^5만원~10만원$/i)!)
+ fireEvent.click(screen.queryByText(/^10만원~$/i)!)
+ fireEvent.click(screen.queryByText(/^전체보기$/i)!)
})
})
\ No newline at end of file
diff --git a/frontend/src/Pages/GiftRecommendPage.tsx b/frontend/src/Pages/GiftRecommendPage.tsx
index 4674859..21447ab 100644
--- a/frontend/src/Pages/GiftRecommendPage.tsx
+++ b/frontend/src/Pages/GiftRecommendPage.tsx
@@ -17,7 +17,6 @@ const GiftRecommendPage = () => {
const [keywordCategory, setKeywordCategory] = useState('All')
const [keywordList, setKeywordList] = useState([])
const [error, setError] = useState(false);
- const [loading, setLoading] = useState(false);
useEffect(() => {
@@ -33,7 +32,6 @@ const GiftRecommendPage = () => {
try {
setError(false);
setKeywordList([]);
- setLoading(true);
const paylaod = { 'category_id': keywordCategory, 'age_gender': keywordAge }
const response = await axios.post(BACKEND_URL + "/gift/shop_keyword/", paylaod);
setKeywordList(response.data)
@@ -41,10 +39,8 @@ const GiftRecommendPage = () => {
catch (e) {
setError(true)
}
- setLoading(false);
}
- if (loading) return
로딩중..
;
if (error) return 에러가 발생했습니다
;
return (
diff --git a/frontend/src/Pages/LoginPage.test.tsx b/frontend/src/Pages/LoginPage.test.tsx
index 8b84db2..8900cc3 100644
--- a/frontend/src/Pages/LoginPage.test.tsx
+++ b/frontend/src/Pages/LoginPage.test.tsx
@@ -13,4 +13,9 @@ describe("", () => {
it("should render without errors", () => {
renderWithProviders();
})
+ it("should push login", () => {
+ renderWithProviders();
+ const loginButton = screen.queryByText(/^로그인$/i)
+ loginButton && fireEvent.click(loginButton)
+ })
})
\ No newline at end of file