From 130b130946115bed3123fe3184b6ce264da44cc6 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:48:24 +0300 Subject: [PATCH] Update tests/__data__ --- tests/__data__/expected/SITES.md | 14 ++ tests/__data__/expected/_sites.md | 13 -- tests/__data__/input/.sites/config.json | 4 - tests/__data__/input/.sites/template.md | 4 - .../iltalehti.fi/iltalehti.fi.channels.xml | 145 ++++++++++++++++++ .../indihometv.com.channels.xml | 133 ++++++++++++++++ .../kan.org.il/kan.org.il_1.channels.xml | 6 + .../kan.org.il/kan.org.il_2.channels.xml | 6 + tests/commands/sites/update.test.ts | 20 +-- 9 files changed, 308 insertions(+), 37 deletions(-) create mode 100644 tests/__data__/expected/SITES.md delete mode 100644 tests/__data__/expected/_sites.md delete mode 100644 tests/__data__/input/.sites/config.json delete mode 100644 tests/__data__/input/.sites/template.md create mode 100644 tests/__data__/input/sites-update/sites/iltalehti.fi/iltalehti.fi.channels.xml create mode 100644 tests/__data__/input/sites-update/sites/indihometv.com/indihometv.com.channels.xml create mode 100644 tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_1.channels.xml create mode 100644 tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_2.channels.xml diff --git a/tests/__data__/expected/SITES.md b/tests/__data__/expected/SITES.md new file mode 100644 index 00000000..5f8597e3 --- /dev/null +++ b/tests/__data__/expected/SITES.md @@ -0,0 +1,14 @@ +# Sites + +\* Total number of channels / with a valid `xmltv-id` + + + + + + + + + + +
SiteChannels *StatusNotes
iltalehti.fi142 / 44🟡https://github.com/iptv-org/epg/issues/2396
indihometv.com130 / 124🟢
kan.org.il6 / 6🔴https://github.com/iptv-org/epg/issues/2273
diff --git a/tests/__data__/expected/_sites.md b/tests/__data__/expected/_sites.md deleted file mode 100644 index bd63aa62..00000000 --- a/tests/__data__/expected/_sites.md +++ /dev/null @@ -1,13 +0,0 @@ -# Sites - - - - - - - - - - - -
SiteStatusNotes
iltalehti.fi🟡https://github.com/iptv-org/epg/issues/2396
indihometv.com🟢
kan.org.il🔴https://github.com/iptv-org/epg/issues/2273
diff --git a/tests/__data__/input/.sites/config.json b/tests/__data__/input/.sites/config.json deleted file mode 100644 index 2574a566..00000000 --- a/tests/__data__/input/.sites/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "build" : "tests/__data__/output/sites.md", - "files" : ["tests/__data__/output/.sites/template.md"] -} \ No newline at end of file diff --git a/tests/__data__/input/.sites/template.md b/tests/__data__/input/.sites/template.md deleted file mode 100644 index c630b91b..00000000 --- a/tests/__data__/input/.sites/template.md +++ /dev/null @@ -1,4 +0,0 @@ -# Sites - - -#include "tests/__data__/output/.sites/_table.md" diff --git a/tests/__data__/input/sites-update/sites/iltalehti.fi/iltalehti.fi.channels.xml b/tests/__data__/input/sites-update/sites/iltalehti.fi/iltalehti.fi.channels.xml new file mode 100644 index 00000000..253417a5 --- /dev/null +++ b/tests/__data__/input/sites-update/sites/iltalehti.fi/iltalehti.fi.channels.xml @@ -0,0 +1,145 @@ + + + Viron ETV + National Geographic + Disney Channel + Disney Junior + Nat Geo Wild Scandinavia + V sport 1 Suomi + V sport 2 Suomi + Viasat Nature/Crime + V sport + V sport + Suomi + V Sport Live 1 + V Sport Live 2 + V Sport Live 3 + V Sport Live 4 + V Sport Live 5 + Discovery Science + The History Channel + Investigation Discovery + Nat Geo Wild Scandinavia + National Geographic + Travel Channel + Viasat Explore + Viasat History + Viasat Nature/Crime + Barnkanalen + Cartoon Network + Cartoonito + Disney Channel + Disney Junior + MTV juniori + Nick Jr. + V film FAMILY + iConcerts + Club MTV + MTV Finland + MTV Live HD + VH1 Classic + Al Jazeera + BBC World News + Bloomberg TV + CNBC + CNN + Deutsche Welle + EuroNews + Sky News + MTV Ava + Fashion TV + Food Network + Frii + Liv + TLC + Travel Channel + V film FAMILY + V film HITS + BBC Nordic + RTL + TV Finland + TV5 Monde + Barnkanalen + SF-kanalen + MTV Urheilu 3 + MTV Aitio + MTV Viihde + V film PREMIERE + V film ACTION + V film FAMILY + V film HITS + Eurosport + Eurosport 2 + MTV Liiga 1 + MTV Liiga 2 + MTV Liiga 3 + MTV Liiga 4 + MTV Liiga 5 + MTV Liiga 6 + MTV Liiga 7 + MTV Liiga UHD + MTV Max + MTV Urheilu 1 + MTV Urheilu 2 + MTV Urheilu 3 + V sport FOOTBALL + V sport GOLF + V sport vinter + V sport 1 Suomi + V sport 2 Suomi + V sport + V sport PREMIUM + V sport + Suomi + V Sport Live 1 + V Sport Live 2 + V Sport Live 3 + V Sport Live 4 + V Sport Live 5 + Animal Planet + MTV Ava + Cartoon Network + MTV juniori + MTV Max + MTV Urheilu 1 + MTV Urheilu 2 + Discovery Channel + Extreme Sports + Star + Frii + Hero + Himlen TV7 + Jim + Kanal5 + Kutonen + Liv + MTV3 + MTV Aitio + MTV Viihde + National Geographic + Nelonen + SF-kanalen + MTV Sub + SVT 1 + SVT 2 + SVT24 + TV7 + TLC + TV3 + TV4 + TV5 + TV6 + V film ACTION + V film FAMILY + V film HITS + V film PREMIERE + Viasat Explore + Viasat History + H2 + V sport FOOTBALL + V sport GOLF + V sport PREMIUM + V sport ULTRA HD + V sport vinter + Yle Teema Fem + Yle TV1 + Yle TV2 + \ No newline at end of file diff --git a/tests/__data__/input/sites-update/sites/indihometv.com/indihometv.com.channels.xml b/tests/__data__/input/sites-update/sites/indihometv.com/indihometv.com.channels.xml new file mode 100644 index 00000000..6eb233d8 --- /dev/null +++ b/tests/__data__/input/sites-update/sites/indihometv.com/indihometv.com.channels.xml @@ -0,0 +1,133 @@ + + + ABC Australia + Aljazeera + Animal Planet + Animax + Aniplus + Antara + ANTV + Arirang + Asian Food Network + ATV + AXN + Bali TV + Bioskop Indonesia + Bloomberg + BTV + Cartoonito + Cartoon Network + CCTV4 + Celestial Movie + CGTN Documentary + Chinese Drama + Cinema World + Citra Dangdut + Citra Drama + News Asia + CNBC Asia + CNBC Indonesia + CNN Indonesia + CNN International + Crime Investigation + Curiosity + Daai TV + Da Vinci Learning + Discovery Asia + Discovery Channel + Dreamworks + Dunia anak + Dunia Lain + DW (English) + Eat & Go + Euronews + FashionTV + Fight Sport + Flik + France 24 + Galaxy + Galaxy Premium + HGTV + History + Hits + HIts Movie + HITS Now + Horee + Horizon Sports + I-Konser + IDTV + IDX + IMC + FunPlanet + Indonesiana TV + Indosiar + iNews + JakTV + Jawa Pos TV + JTV + KBS World + Kix + Kompas TV + Kplus + Lifetime + Lingua + Love Nature + Maxstream + Mentari TV + Metro TV + MOJI + Moonbug + MQTV + MTATV + MTV Live + Musik Indonesia + MyKidz + NBA + Net. + New Tv Comprehensive + New Tv Finance + New Tv Variety + nhk world Japan + Nickelodeon + Nick Junior + Insert + Nusantara TV + SONE + Phoenix Chinese + Phoenix InfoNews + Prambors + AlQuran Kareem + Rajawali TV + Rock Entertainment + Rock Action + Rodja TV + RRI NET + SCTV + SEA Today + Seru! + Shenzen + SINDO News TV + SPOTV 2 + SPOTV + Studio Universal + Tawaf TV + Tech Storm + Thrill + TLC + Trans7 + TransTV + TV5Monde + TV9 NU + TVBS News + Muhammadiyah TV + MUI TV + TVN + TVN Movies + TV One + TVRI + UChannel + AllPlay Ent + Warner + ZBioskop + Zhejiang + diff --git a/tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_1.channels.xml b/tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_1.channels.xml new file mode 100644 index 00000000..c89752bc --- /dev/null +++ b/tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_1.channels.xml @@ -0,0 +1,6 @@ + + + مكان + כאן 11 + חינוכית + diff --git a/tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_2.channels.xml b/tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_2.channels.xml new file mode 100644 index 00000000..c89752bc --- /dev/null +++ b/tests/__data__/input/sites-update/sites/kan.org.il/kan.org.il_2.channels.xml @@ -0,0 +1,6 @@ + + + مكان + כאן 11 + חינוכית + diff --git a/tests/commands/sites/update.test.ts b/tests/commands/sites/update.test.ts index 0af18d4c..c14a7370 100644 --- a/tests/commands/sites/update.test.ts +++ b/tests/commands/sites/update.test.ts @@ -3,24 +3,14 @@ import fs from 'fs-extra' import { pathToFileURL } from 'node:url' import os from 'os' -let ENV_VAR = - 'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites' +let ENV_VAR = 'SITES_DIR=tests/__data__/input/sites-update/sites ROOT_DIR=tests/__data__/output' if (os.platform() === 'win32') { ENV_VAR = - 'SET "DOT_SITES_DIR=tests/__data__/output/.sites" && SET "SITES_DIR=tests/__data__/input/sites-update/sites" &&' + 'SET "SITES_DIR=tests/__data__/input/sites-update/sites" && SET "ROOT_DIR=tests/__data__/output" &&' } beforeEach(() => { fs.emptyDirSync('tests/__data__/output') - fs.mkdirSync('tests/__data__/output/.sites') - fs.copyFileSync( - 'tests/__data__/input/.sites/config.json', - 'tests/__data__/output/.sites/config.json' - ) - fs.copyFileSync( - 'tests/__data__/input/.sites/template.md', - 'tests/__data__/output/.sites/template.md' - ) }) it('can update SITES.md', () => { @@ -29,11 +19,9 @@ it('can update SITES.md', () => { const stdout = execSync(cmd, { encoding: 'utf8' }) if (process.env.DEBUG === 'true') console.log(cmd, stdout) - expect(content('tests/__data__/output/sites.md')).toEqual( - content('tests/__data__/expected/_sites.md') + expect(content('tests/__data__/output/SITES.md')).toEqual( + content('tests/__data__/expected/SITES.md') ) - - expect(true).toBe(true) }) function content(filepath: string) {