import { describe, it, expect } from 'vitest'; import { DEFAULT_SETTINGS, type UserSettings } from '~/types'; describe('Settings validation logic', () => { it('should have valid default settings', () => { expect(DEFAULT_SETTINGS.max_articles_per_source).toBe(3); expect(DEFAULT_SETTINGS.ai_model).toBe(''); expect(DEFAULT_SETTINGS.ai_model_websearch).toBe(''); expect(DEFAULT_SETTINGS.ai_provider).toBe(''); expect(DEFAULT_SETTINGS.rate_limit_max_requests).toBeNull(); expect(DEFAULT_SETTINGS.rate_limit_time_window_seconds).toBeNull(); }); it('should parse batch_size as integer with fallback', () => { const parseBatchSize = (value: string): number => parseInt(value) || 5; expect(parseBatchSize('10')).toBe(10); expect(parseBatchSize('')).toBe(5); expect(parseBatchSize('abc')).toBe(5); }); it('should parse max_articles_per_source as integer with fallback', () => { const parseMaxArticles = (value: string): number => parseInt(value) || 3; expect(parseMaxArticles('5')).toBe(5); expect(parseMaxArticles('')).toBe(3); expect(parseMaxArticles('abc')).toBe(3); }); });