feat: 앱 하단 내비게이션·설정/계정정보·가입정보 변경 + 프론트 테스트·CI 게이트
CI / build (push) Failing after 10m29s

- 하단 내비게이션(뒤로/앞으로/홈/새로고침/설정), 사이드바 홈 제거
- 설정 화면: 계정정보·앱 버전(package.json)·App Data 삭제
- 가입정보 변경: 비밀번호 재인증 → 이름/이메일 수정
- 로그인 후 대시보드(/) 이동, 로그인 전 햄버거·네이버 로그인 버튼 숨김
- Vitest 도입(32): authApi/accountApi 와이어링, auth/ui 스토어, 로그인 플로우
- CI(.gitea): npm test 게이트 추가

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-06 14:08:01 +09:00
parent c5e4c2dad7
commit c9ff605ac9
22 changed files with 2467 additions and 15 deletions
+81
View File
@@ -0,0 +1,81 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { mount, flushPromises } from '@vue/test-utils'
import { setActivePinia, createPinia } from 'pinia'
// useRouter().push 를 캡처
const { pushMock } = vi.hoisted(() => ({ pushMock: vi.fn() }))
vi.mock('vue-router', () => ({ useRouter: () => ({ push: pushMock }) }))
vi.mock('@/api/authApi', () => ({
authApi: {
login: vi.fn(),
signupEnabled: vi.fn(() => Promise.resolve({ enabled: true })),
},
}))
vi.mock('@capacitor/preferences', () => ({
Preferences: {
set: vi.fn(() => Promise.resolve()),
get: vi.fn(() => Promise.resolve({ value: null })),
remove: vi.fn(() => Promise.resolve()),
},
}))
import { authApi } from '@/api/authApi'
import { useUiStore } from '@/stores/ui'
import LoginModal from '@/components/LoginModal.vue'
function mountOpen() {
const ui = useUiStore()
return { ui, wrapper: mount(LoginModal, { global: { stubs: { teleport: true } } }) }
}
async function submitLogin(wrapper) {
await wrapper.find('input[autocomplete="username"]').setValue('u1')
await wrapper.find('input[autocomplete="current-password"]').setValue('pw')
await wrapper.find('form').trigger('submit')
await flushPromises()
}
describe('LoginModal 로그인 플로우', () => {
beforeEach(() => {
setActivePinia(createPinia())
localStorage.clear()
authApi.login.mockResolvedValue({ token: 'tok', member: { id: 1, loginId: 'u1', name: 'N' } })
})
it('redirect 없으면 로그인 후 대시보드(/)로 이동', async () => {
const { ui, wrapper } = mountOpen()
ui.openLogin('')
await wrapper.vm.$nextTick()
await submitLogin(wrapper)
expect(authApi.login).toHaveBeenCalledWith({ loginId: 'u1', password: 'pw', rememberMe: true })
expect(pushMock).toHaveBeenCalledWith('/')
expect(ui.loginOpen).toBe(false)
})
it('redirect 있으면 보존된 목적지로 이동', async () => {
const { ui, wrapper } = mountOpen()
ui.openLogin('/account/wallets')
await wrapper.vm.$nextTick()
await submitLogin(wrapper)
expect(pushMock).toHaveBeenCalledWith('/account/wallets')
})
it('로그인 실패 시 에러 표시 + 이동 없음', async () => {
authApi.login.mockRejectedValueOnce({ response: { data: { message: '아이디 또는 비밀번호가 올바르지 않습니다.' } } })
const { ui, wrapper } = mountOpen()
ui.openLogin('')
await wrapper.vm.$nextTick()
await submitLogin(wrapper)
expect(pushMock).not.toHaveBeenCalled()
expect(ui.loginOpen).toBe(true)
expect(wrapper.text()).toContain('아이디 또는 비밀번호가 올바르지 않습니다.')
})
})
+6 -2
View File
@@ -13,6 +13,9 @@ function goSignup() {
ui.openSignup()
}
// 소셜 로그인(네이버)은 준비 중 — 잠시 숨김. 구현 완료 시 true 로 전환.
const SOCIAL_LOGIN_ENABLED = false
const form = reactive({ loginId: '', password: '', rememberMe: true })
const loading = ref(false)
const error = ref(null)
@@ -41,7 +44,8 @@ async function handleLogin() {
await auth.login(form.loginId, form.password, form.rememberMe)
const redirect = ui.redirectPath
ui.closeLogin()
if (redirect) router.push(redirect)
// 가드가 보존한 목적지가 있으면 그곳으로, 없으면 대시보드(홈)로 이동
router.push(redirect || '/')
} catch (e) {
error.value = e.response?.data?.message || '로그인에 실패했습니다.'
} finally {
@@ -81,7 +85,7 @@ onUnmounted(() => window.removeEventListener('keydown', onKeydown))
<p v-if="error" class="msg error">{{ error }}</p>
<button type="button" class="naver" :disabled="loading" @click="handleNaverLogin">
<button v-if="SOCIAL_LOGIN_ENABLED" type="button" class="naver" :disabled="loading" @click="handleNaverLogin">
네이버로 로그인 (준비 )
</button>
+111
View File
@@ -0,0 +1,111 @@
<script setup>
import { computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
const isHome = computed(() => route.path === '/')
const isSettings = computed(() => route.path.startsWith('/settings'))
function goBack() {
// 히스토리가 있으면 뒤로, 없으면 홈으로 (앱 첫 화면에서 빠져나가지 않게)
if (window.history.length > 1) router.back()
else router.push('/')
}
function goForward() {
router.forward()
}
function goHome() {
if (!isHome.value) router.push('/')
}
function refresh() {
// 현재 화면 데이터를 다시 불러옴 — 저장된 세션은 복원되므로 로그아웃되지 않음
window.location.reload()
}
function goSettings() {
if (!isSettings.value) router.push('/settings')
}
</script>
<template>
<nav class="bottom-nav" aria-label=" 내비게이션">
<button type="button" class="nav-btn" @click="goBack">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M19 12H5" /><path d="M12 19l-7-7 7-7" />
</svg>
<span>뒤로</span>
</button>
<button type="button" class="nav-btn" @click="goForward">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 12h14" /><path d="M12 5l7 7-7 7" />
</svg>
<span>앞으로</span>
</button>
<button type="button" class="nav-btn" :class="{ active: isHome }" @click="goHome">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /><path d="M9 22V12h6v10" />
</svg>
<span></span>
</button>
<button type="button" class="nav-btn" @click="refresh">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M23 4v6h-6" /><path d="M1 20v-6h6" />
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10" /><path d="M1 14l4.64 4.36A9 9 0 0 0 20.49 15" />
</svg>
<span>새로고침</span>
</button>
<button type="button" class="nav-btn" :class="{ active: isSettings }" @click="goSettings">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 21v-7" /><path d="M4 10V3" /><path d="M12 21v-9" /><path d="M12 8V3" />
<path d="M20 21v-5" /><path d="M20 12V3" /><path d="M1 14h6" /><path d="M9 8h6" /><path d="M17 16h6" />
</svg>
<span>설정</span>
</button>
</nav>
</template>
<style scoped>
.bottom-nav {
display: flex;
align-items: stretch;
justify-content: space-around;
height: 56px;
padding-bottom: env(safe-area-inset-bottom, 0);
background: var(--color-background-soft);
border-top: 1px solid var(--color-border);
}
.nav-btn {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.15rem;
border: 0;
background: transparent;
color: var(--color-text);
cursor: pointer;
font-size: 0.68rem;
opacity: 0.78;
transition: opacity 0.15s ease, color 0.15s ease;
}
.nav-btn svg {
width: 22px;
height: 22px;
}
.nav-btn:hover {
opacity: 1;
}
.nav-btn:active {
opacity: 0.5;
}
.nav-btn.active {
color: hsla(160, 100%, 37%, 1);
opacity: 1;
}
</style>
+1 -1
View File
@@ -17,7 +17,7 @@ async function handleLogout() {
<template>
<header class="app-header">
<div class="header-left">
<button class="hamburger" type="button" aria-label="메뉴" @click="ui.toggleSidebar()">
<button v-if="auth.isAuthenticated" class="hamburger" type="button" aria-label="메뉴" @click="ui.toggleSidebar()">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
<path d="M3 12h18" /><path d="M3 6h18" /><path d="M3 18h18" />
</svg>
+1 -4
View File
@@ -15,11 +15,8 @@ const ui = useUiStore()
<button class="drawer-close" type="button" aria-label="닫기" @click="ui.closeSidebar()">×</button>
</div>
<nav class="menu">
<RouterLink to="/" class="menu-item"></RouterLink>
<!-- 가계부 영역 -->
<!-- 가계부 영역 (홈은 하단 내비게이션으로 이동) -->
<template v-if="auth.isAuthenticated">
<hr class="menu-divider" />
<RouterLink to="/account/entries" class="menu-item">가계부 내역</RouterLink>
<RouterLink to="/account/stats" class="menu-item">통계</RouterLink>
<RouterLink to="/account/recurrings" class="menu-item">고정 지출</RouterLink>