- 하단 내비게이션(뒤로/앞으로/홈/새로고침/설정), 사이드바 홈 제거 - 설정 화면: 계정정보·앱 버전(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:
@@ -0,0 +1,60 @@
|
||||
import { describe, it, expect, vi } from 'vitest'
|
||||
|
||||
// http(axios 인스턴스)를 모킹 — 실제 네트워크 없이 호출 형태만 검증
|
||||
vi.mock('@/api/http', () => ({
|
||||
default: {
|
||||
get: vi.fn(() => Promise.resolve({})),
|
||||
post: vi.fn(() => Promise.resolve({})),
|
||||
put: vi.fn(() => Promise.resolve({})),
|
||||
delete: vi.fn(() => Promise.resolve({})),
|
||||
},
|
||||
}))
|
||||
|
||||
import http from '@/api/http'
|
||||
import { authApi } from '@/api/authApi'
|
||||
|
||||
describe('authApi 엔드포인트 와이어링', () => {
|
||||
it('signup → POST /auth/signup', () => {
|
||||
const payload = { loginId: 'u1', password: 'pw', name: '홍길동' }
|
||||
authApi.signup(payload)
|
||||
expect(http.post).toHaveBeenCalledWith('/auth/signup', payload)
|
||||
})
|
||||
|
||||
it('signupEnabled → GET /auth/signup-enabled', () => {
|
||||
authApi.signupEnabled()
|
||||
expect(http.get).toHaveBeenCalledWith('/auth/signup-enabled')
|
||||
})
|
||||
|
||||
it('login → POST /auth/login', () => {
|
||||
const payload = { loginId: 'u1', password: 'pw', rememberMe: true }
|
||||
authApi.login(payload)
|
||||
expect(http.post).toHaveBeenCalledWith('/auth/login', payload)
|
||||
})
|
||||
|
||||
it('logout → POST /auth/logout', () => {
|
||||
authApi.logout()
|
||||
expect(http.post).toHaveBeenCalledWith('/auth/logout')
|
||||
})
|
||||
|
||||
it('me → GET /auth/me', () => {
|
||||
authApi.me()
|
||||
expect(http.get).toHaveBeenCalledWith('/auth/me')
|
||||
})
|
||||
|
||||
it('changePassword → PUT /auth/password', () => {
|
||||
const payload = { currentPassword: 'a', newPassword: 'bbbbbbbb' }
|
||||
authApi.changePassword(payload)
|
||||
expect(http.put).toHaveBeenCalledWith('/auth/password', payload)
|
||||
})
|
||||
|
||||
it('verifyPassword → POST /auth/verify-password (password 래핑)', () => {
|
||||
authApi.verifyPassword('secret')
|
||||
expect(http.post).toHaveBeenCalledWith('/auth/verify-password', { password: 'secret' })
|
||||
})
|
||||
|
||||
it('updateProfile → PUT /auth/profile', () => {
|
||||
const payload = { name: '새이름', email: 'a@b.com' }
|
||||
authApi.updateProfile(payload)
|
||||
expect(http.put).toHaveBeenCalledWith('/auth/profile', payload)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user