- lib/ai-usage.ts: MUSIC_DAILY_LIMIT=1 추가, AiService 타입에 'music' 포함 - lib/__tests__/ai-usage.test.ts: MUSIC_DAILY_LIMIT 상수 검증 테스트 추가 - supabase/migrations/2026-07-03-phase3a-music.sql: music_tracks 테이블, CHECK 확장, service_settings 정리 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AAtcmKKtqDUe4NyVgy1aLQ
21 lines
927 B
TypeScript
21 lines
927 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { kstDayStartISO, SAJU_DAILY_LIMIT, TAROT_DAILY_LIMIT, MUSIC_DAILY_LIMIT } from '../ai-usage';
|
|
|
|
describe('kstDayStartISO', () => {
|
|
it('KST 자정을 UTC로 환산한다 (KST 15:00 UTC = 당일 00:00 KST)', () => {
|
|
// 2026-07-02T05:00:00Z = 2026-07-02 14:00 KST → 그날 KST 자정 = 2026-07-01T15:00:00Z
|
|
expect(kstDayStartISO(new Date('2026-07-02T05:00:00Z'))).toBe('2026-07-01T15:00:00.000Z');
|
|
});
|
|
it('KST 자정 직후도 같은 날로 계산한다', () => {
|
|
// 2026-07-01T15:30:00Z = 2026-07-02 00:30 KST → KST 자정 = 2026-07-01T15:00:00Z
|
|
expect(kstDayStartISO(new Date('2026-07-01T15:30:00Z'))).toBe('2026-07-01T15:00:00.000Z');
|
|
});
|
|
it('제한 상수', () => {
|
|
expect(SAJU_DAILY_LIMIT).toBe(1);
|
|
expect(TAROT_DAILY_LIMIT).toBe(3);
|
|
});
|
|
it('음악 일일 제한 상수', () => {
|
|
expect(MUSIC_DAILY_LIMIT).toBe(1);
|
|
});
|
|
});
|