diff --git a/public/radio/europe/italy.json b/public/radio/europe/italy.json index f95b5161..98bfceb4 100644 --- a/public/radio/europe/italy.json +++ b/public/radio/europe/italy.json @@ -379,5 +379,16 @@ "cros": false, "stream": "https://s.streampunk.cc/ondarossa.mp3", "features": "/img/europe/italy/ondarossa.png" + }, + "mi-amigo-radio": { + "title": "Mi Amigo Radio", + "description": "Classic Hits and Oldies from Legnano, Lombardy, Italy.", + "type": "audio/aac", + "url": "https://www.miamigoradio.it/", + "category": "Classic Hits and Oldies", + "language": "Italian", + "cros": false, + "stream": "https://nr12.newradio.it:8662/Live", + "features": "https://www.miamigoradio.it/css-img/logoRadioMiAmigo.svg" } } diff --git a/tests/mi-amigo-radio.test.mjs b/tests/mi-amigo-radio.test.mjs new file mode 100644 index 00000000..d8691845 --- /dev/null +++ b/tests/mi-amigo-radio.test.mjs @@ -0,0 +1,40 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; + +import { createPlaybackStation } from '../utils/playback-station.mjs'; +import { buildPlaybackSources } from '../utils/radio-source-plan.mjs'; + +const catalog = JSON.parse( + readFileSync(new URL('../public/radio/europe/italy.json', import.meta.url), 'utf8'), +); + +test('Mi Amigo Radio offers its direct AAC stream then the configured CORS fallback', () => { + const entry = catalog['mi-amigo-radio']; + assert.ok(entry, 'Mi Amigo Radio must be listed in Italy'); + assert.equal(entry.title, 'Mi Amigo Radio'); + assert.equal(entry.url, 'https://www.miamigoradio.it/'); + assert.equal(entry.type, 'audio/aac'); + assert.equal(entry.stream, 'https://nr12.newradio.it:8662/Live'); + assert.equal(entry.features, 'https://www.miamigoradio.it/css-img/logoRadioMiAmigo.svg'); + assert.equal(entry.cros, false); + + const corsServer = 'https://cors.example/'; + const station = createPlaybackStation({ + area: 'europe', + country: 'italy', + id: 'mi-amigo-radio', + meta: entry, + corsServer, + }); + + assert.equal(station.url, '/europe/italy/mi-amigo-radio'); + const candidates = buildPlaybackSources(station.sources, corsServer); + assert.deepEqual( + candidates.map(({ src, proxied }) => [src, Boolean(proxied)]), + [ + ['https://nr12.newradio.it:8662/Live', false], + ['https://cors.example/https://nr12.newradio.it:8662/Live', true], + ], + ); +}); diff --git a/tests/station-classification.test.mjs b/tests/station-classification.test.mjs index 0c41115d..2d67aa86 100644 --- a/tests/station-classification.test.mjs +++ b/tests/station-classification.test.mjs @@ -73,7 +73,11 @@ test('entire current catalog has an auditable inventory without stream URLs or m assert.equal(summary.geographicStations+summary.globalProviderStations, summary.total); assert.equal(new Set(records.map(r=>r.path)).size, records.length); assert.ok(summary.declaredCategory>0); - assert.equal(summary.declaredLanguage, 7, 'only Global Radio currently declares explicit languages'); + const languageRecords = records.filter(record => Boolean(record.language)); + assert.equal(summary.declaredLanguage, languageRecords.length, + 'summary must count actual declared station languages'); + assert.equal(records.filter(record => record.area === 'global-radio' && record.language).length, + summary.globalProviderStations, 'Global Radio stations retain their explicit languages'); assert.equal(summary.awaitingContentReview+summary.contentClassified,summary.total); assert.ok(summary.awaitingContentReview>0, 'missing evidence must stay visible'); assert.ok(Object.values(summary.countByArea).every(n=>n>0));