Skip to content

Commit 2a11f78

Browse files
authored
test(fe): remove logout flow in login/logout flow test to focus on login process (#248)
1 parent 42e0049 commit 2a11f78

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

apps/client/src/features/auth/auth.api.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@ import {
99
PostRefreshResponseSchema,
1010
} from '@/features/auth/auth.dto';
1111

12-
const AUTH_BASE_URL = '/api/auth';
13-
1412
export const login = (body: PostLoginRequestDTO) =>
1513
axios
16-
.post<PostLoginResponseDTO>(`${AUTH_BASE_URL}/login`, PostLoginRequestSchema.parse(body))
14+
.post<PostLoginResponseDTO>(`/api/auth/login`, PostLoginRequestSchema.parse(body))
1715
.then((res) => PostLoginResponseSchema.parse(res.data));
1816

19-
export const logout = () => axios.post(`${AUTH_BASE_URL}/logout`);
17+
export const logout = () => axios.post(`/api/auth/logout`);
2018

2119
export const refresh = () =>
2220
axios
23-
.post<PostRefreshResponseDTO>(`${AUTH_BASE_URL}/token`, undefined, {
21+
.post<PostRefreshResponseDTO>(`/api/auth/token`, undefined, {
2422
withCredentials: true,
2523
})
2624
.then((res) => PostRefreshResponseSchema.parse(res.data));

apps/client/src/routes/session/$sessionId/index.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createFileRoute, redirect } from '@tanstack/react-router';
2+
import { useEffect } from 'react';
23

34
import { refresh, useAuthStore } from '@/features/auth';
45
import { getSessionToken, useSessionStore } from '@/features/session';
@@ -7,8 +8,18 @@ import { getQuestions } from '@/features/session/qna';
78

89
import { QuestionList } from '@/components';
910

11+
function SessionComponent() {
12+
const { sessionTitle } = useSessionStore();
13+
14+
useEffect(() => {
15+
if (sessionTitle) document.title = `Ask-It - ${sessionTitle}`;
16+
}, [sessionTitle]);
17+
18+
return <QuestionList />;
19+
}
20+
1021
export const Route = createFileRoute('/session/$sessionId/')({
11-
component: QuestionList,
22+
component: SessionComponent,
1223
beforeLoad: async ({ params: { sessionId } }) => {
1324
const {
1425
reset,

apps/client/tests/HomePage.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ test('회원 가입이 이미 중복된 닉네임이 있어서 실패하는 경
128128
await expect(signUpButton).toBeDisabled();
129129
});
130130

131-
test('로그인 / 로그아웃 플로우 전체 테스트', async ({ page }) => {
131+
test('로그인 플로우 전체 테스트', async ({ page }) => {
132132
await page.click('text=로그인');
133133

134134
const loginButton = page.getByRole('button', { name: '로그인' }).nth(1);
@@ -151,7 +151,4 @@ test('로그인 / 로그아웃 플로우 전체 테스트', async ({ page }) =>
151151
expect((await response).status()).toBe(200);
152152

153153
await expect(page.locator('text=로그인 되었습니다.')).toBeVisible();
154-
155-
await page.click('text=로그아웃');
156-
await expect(page.locator('text=로그아웃 되었습니다.')).toBeVisible();
157154
});

0 commit comments

Comments
 (0)