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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 14:08:01 +09:00

70 lines
2.5 KiB
JavaScript

import { describe, it, expect, vi } from 'vitest'
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 { accountApi } from '@/api/accountApi'
describe('accountApi 가계부 CRUD 와이어링', () => {
it('list → GET /account/entries (필터 params)', () => {
accountApi.list({ year: 2026, month: 6, type: 'EXPENSE' })
expect(http.get).toHaveBeenCalledWith('/account/entries', {
params: { year: 2026, month: 6, type: 'EXPENSE', category: undefined, walletId: undefined, keyword: undefined, tagId: undefined },
})
})
it('create → POST /account/entries', () => {
const payload = { type: 'EXPENSE', amount: 1000, category: '식비' }
accountApi.create(payload)
expect(http.post).toHaveBeenCalledWith('/account/entries', payload)
})
it('update → PUT /account/entries/:id', () => {
accountApi.update(42, { amount: 2000 })
expect(http.put).toHaveBeenCalledWith('/account/entries/42', { amount: 2000 })
})
it('remove → DELETE /account/entries/:id', () => {
accountApi.remove(42)
expect(http.delete).toHaveBeenCalledWith('/account/entries/42')
})
it('summary → GET /account/summary', () => {
accountApi.summary({ year: 2026, month: 6 })
expect(http.get).toHaveBeenCalledWith('/account/summary', { params: { year: 2026, month: 6 } })
})
it('netWorth → GET /account/networth', () => {
accountApi.netWorth()
expect(http.get).toHaveBeenCalledWith('/account/networth')
})
it('budgetStatus → GET /account/budgets/status', () => {
accountApi.budgetStatus({ year: 2026, month: 6 })
expect(http.get).toHaveBeenCalledWith('/account/budgets/status', { params: { year: 2026, month: 6 } })
})
it('pendingCount → GET /account/entries/pending/count', () => {
accountApi.pendingCount()
expect(http.get).toHaveBeenCalledWith('/account/entries/pending/count')
})
it('confirmEntry → POST /account/entries/:id/confirm (payload 기본값 {})', () => {
accountApi.confirmEntry(7)
expect(http.post).toHaveBeenCalledWith('/account/entries/7/confirm', {})
})
it('createWallet → POST /account/wallets', () => {
const payload = { name: '주거래', type: 'ASSET' }
accountApi.createWallet(payload)
expect(http.post).toHaveBeenCalledWith('/account/wallets', payload)
})
})