import { describe, it, expect } from 'vitest'; describe('App', () => { describe('computed hasStream', () => { it('should return false when stream_url is missing', () => { const streamUrl = ''; expect(!!streamUrl && streamUrl.trim().length > 0).toBe(false); }); it('should return false when stream_url is whitespace', () => { const streamUrl = ' '; expect(!!streamUrl && streamUrl.trim().length > 0).toBe(false); }); it('should return true when stream_url is a valid URL', () => { const streamUrl = 'https://stream.example.com/live'; expect(!!streamUrl && streamUrl.trim().length > 0).toBe(true); }); }); describe('stationConfig title formatting', () => { it('should concatenate name_primary and name_secondary with a space', () => { const namePrimary = 'KM'; const nameSecondary = 'TN'; const fullName = `${namePrimary} ${nameSecondary}`.trim(); expect(fullName).toBe('KM TN'); }); it('should trim trailing space when name_secondary is empty', () => { const namePrimary = 'KM'; const nameSecondary = ''; const fullName = `${namePrimary} ${nameSecondary}`.trim(); expect(fullName).toBe('KM'); }); }); });