Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
โ€ฆ4-touroot into feature/fe/#489
  • Loading branch information
0jenn0 committed Oct 22, 2024
2 parents fb4409e + 9a2ea31 commit 5f6b587
Show file tree
Hide file tree
Showing 85 changed files with 24,434 additions and 3,630 deletions.
27 changes: 15 additions & 12 deletions frontend/__tests__/travelPlanRegisterPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderHook, waitFor } from "@testing-library/react";

import { TravelPlanPlace } from "@type/domain/travelPlan";

import { useTravelPlanDays } from "@hooks/pages/useTravelPlanDays";
import { useTravelPlanDays } from "@hooks/pages/useTravelPlanFormState/useTravelPlanDays";
import useCalendar from "@hooks/useCalendar";

import { createTravelPlanRegisterHook } from "./utils/createTravelPlanRegisterHook";
Expand All @@ -26,6 +26,7 @@ const REGISTER_TRAVEL_PLAN = {
lng: 126.977,
},
description: "์กฐ์„  ์‹œ๋Œ€์— ์ง€์–ด์ง„ ๋‹ค์„ฏ ๊ฐœ์˜ ๊ถ๊ถ ์ค‘ ๊ฐ€์žฅ ํฐ ๊ถ๊ถ์ž…๋‹ˆ๋‹ค.",
countryCode: "kr",
},
],
},
Expand Down Expand Up @@ -89,7 +90,7 @@ describe("์—ฌํ–‰ ๊ณ„ํš ๋“ฑ๋ก ํŽ˜์ด์ง€ ํ…Œ์ŠคํŠธ", () => {

// when
act(() => {
result.current.onAddDay();
result.current.handleAddDay();
});

// then
Expand All @@ -103,7 +104,7 @@ describe("์—ฌํ–‰ ๊ณ„ํš ๋“ฑ๋ก ํŽ˜์ด์ง€ ํ…Œ์ŠคํŠธ", () => {

// when
act(() => {
result.current.onDeleteDay(0);
result.current.handleDeleteDay(0);
});

// then
Expand All @@ -113,22 +114,23 @@ describe("์—ฌํ–‰ ๊ณ„ํš ๋“ฑ๋ก ํŽ˜์ด์ง€ ํ…Œ์ŠคํŠธ", () => {
test("์‚ฌ์šฉ์ž๋Š” 1์ผ์ฐจ์— '๊ฒฝ๋ณต๊ถ'์ด๋ผ๋Š” ์žฅ์†Œ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.", () => {
// given
const { result } = renderHook(() => useTravelPlanDays([]));
const newPlace: Pick<TravelPlanPlace, "placeName" | "position" | "todos"> = {
const newPlace: Pick<TravelPlanPlace, "placeName" | "position" | "todos" | "countryCode"> = {
placeName: "๊ฒฝ๋ณต๊ถ",
position: {
lat: 37.5796,
lng: 126.977,
},
todos: [],
countryCode: "kr",
};

// when
act(() => {
result.current.onAddDay();
result.current.handleAddDay();
});

act(() => {
result.current.onAddPlace(0, newPlace);
result.current.handleAddPlace(0, newPlace);
});

// then
Expand All @@ -139,26 +141,27 @@ describe("์—ฌํ–‰ ๊ณ„ํš ๋“ฑ๋ก ํŽ˜์ด์ง€ ํ…Œ์ŠคํŠธ", () => {
test("์‚ฌ์šฉ์ž๋Š” ์ถ”๊ฐ€ํ•œ ๊ฒฝ๋ณต๊ถ์„ ์‚ญ์ œํ•  ์ˆ˜ ์žˆ๋‹ค.", () => {
// given
const { result } = renderHook(() => useTravelPlanDays([]));
const newPlace: Pick<TravelPlanPlace, "placeName" | "position" | "todos"> = {
const newPlace: Pick<TravelPlanPlace, "placeName" | "position" | "todos" | "countryCode"> = {
placeName: "๊ฒฝ๋ณต๊ถ",
position: {
lat: 37.5796,
lng: 126.977,
},
todos: [],
countryCode: "kr",
};

// when
act(() => {
result.current.onAddDay();
result.current.handleAddDay();
});

act(() => {
result.current.onAddPlace(0, newPlace);
result.current.handleAddPlace(0, newPlace);
});

act(() => {
result.current.onDeletePlace(0, 0);
result.current.handleDeletePlace(0, 0);
});

// then
Expand All @@ -180,11 +183,11 @@ describe("์—ฌํ–‰ ๊ณ„ํš ๋“ฑ๋ก ํŽ˜์ด์ง€ ํ…Œ์ŠคํŠธ", () => {

// // when
// act(() => {
// result.current.onAddDay();
// result.current.handleAddDay();
// });

// act(() => {
// result.current.onAddPlace(0, newPlace);
// result.current.handleAddPlace(0, newPlace);
// });

// act(() => {
Expand Down
Loading

0 comments on commit 5f6b587

Please sign in to comment.