fix(stock): watchlist 렌더 크래시 가드·성공 시 폼 리셋·정렬 테스트

- watchlistUtils: Object.hasOwn 가드 + Object.freeze (프로토타입 키 → 함수 반환 방지)
- useWatchlist.add: boolean 반환 + 재진입 가드; 성공 시에만 폼 리셋
- byFiredAtDesc 멀티 알림 정렬 테스트 추가

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UHXzpsZQxKG9hQmNRfZjRS
This commit is contained in:
2026-07-03 02:13:59 +09:00
parent 3656ee9a59
commit 6bf36f34f0
5 changed files with 51 additions and 17 deletions

View File

@@ -32,6 +32,20 @@ describe('conditionLabel', () => {
});
});
describe('프로토타입 키 방어 (render-safe)', () => {
it('conditionLabel은 상속 키에도 문자열을 반환', () => {
expect(conditionLabel('toString')).toBe('toString');
expect(typeof conditionLabel('toString')).toBe('string');
expect(typeof conditionLabel('constructor')).toBe('string');
});
it('kindMeta는 상속 키에도 문자열 label + 회색 폴백', () => {
const m = kindMeta('constructor');
expect(typeof m.label).toBe('string');
expect(m.label).toBe('constructor');
expect(m.color).toBe('#94a3b8');
});
});
describe('normalizeTicker', () => {
it('공백 trim', () => {
expect(normalizeTicker(' 005930 ')).toBe('005930');