diff --git a/tests/__data__/expected/guide.xml b/tests/__data__/expected/guide.xml new file mode 100644 index 00000000..cb8791d4 --- /dev/null +++ b/tests/__data__/expected/guide.xml @@ -0,0 +1,14 @@ + +Channel 1https://example.com +Channel 1https://example2.com +Channel 2https://example.com +Channel 3https://example2.com +Channel 4https://example2.com +Program1 (example.com) +Programme1 (example.com) +Programme1 (example2.com) +Program1 (example.com) +Programme1 (example.com) +Program1 (example2.com) +Program1 (example2.com) + \ No newline at end of file diff --git a/tests/__data__/expected/guide.xml.gz b/tests/__data__/expected/guide.xml.gz new file mode 100644 index 00000000..d6677245 Binary files /dev/null and b/tests/__data__/expected/guide.xml.gz differ diff --git a/tests/__data__/expected/guide2.xml b/tests/__data__/expected/guide2.xml new file mode 100644 index 00000000..b358b044 --- /dev/null +++ b/tests/__data__/expected/guide2.xml @@ -0,0 +1,8 @@ + +Channel 1https://example.com +Channel 2https://example.com +Program1 (example.com) +Programme1 (example.com) +Program1 (example.com) +Programme1 (example.com) + \ No newline at end of file diff --git a/tests/__data__/expected/guides/en/example.com.xml b/tests/__data__/expected/guides/en/example.com.xml index e99bf680..2d958ef6 100644 --- a/tests/__data__/expected/guides/en/example.com.xml +++ b/tests/__data__/expected/guides/en/example.com.xml @@ -1,5 +1,6 @@ Channel 1https://example.com Channel 2https://example.com -Program1 +Program1 (example.com) +Program1 (example.com) \ No newline at end of file diff --git a/tests/__data__/expected/guides/fr/example.com.xml b/tests/__data__/expected/guides/fr/example.com.xml index b9653f35..59aafc38 100644 --- a/tests/__data__/expected/guides/fr/example.com.xml +++ b/tests/__data__/expected/guides/fr/example.com.xml @@ -1,4 +1,5 @@ Channel 1https://example.com -Program1 +Programme1 (example.com) +Programme1 (example.com) \ No newline at end of file diff --git a/tests/__data__/expected/sites/channels-parse/channels-parse-clean.channels.xml b/tests/__data__/expected/sites/channels-parse/channels-parse-clean.channels.xml new file mode 100644 index 00000000..ebf174d8 --- /dev/null +++ b/tests/__data__/expected/sites/channels-parse/channels-parse-clean.channels.xml @@ -0,0 +1,5 @@ + + + CNN International + BBC World News + diff --git a/tests/__data__/expected/sites/channels-parse/channels-parse.channels.xml b/tests/__data__/expected/sites/channels-parse/channels-parse.channels.xml new file mode 100644 index 00000000..57e699ea --- /dev/null +++ b/tests/__data__/expected/sites/channels-parse/channels-parse.channels.xml @@ -0,0 +1,5 @@ + + + BBC World News + CNN International + diff --git a/tests/__data__/expected/sites/parse-channels-clean.channels.xml b/tests/__data__/expected/sites/parse-channels-clean.channels.xml deleted file mode 100644 index 2b8e092f..00000000 --- a/tests/__data__/expected/sites/parse-channels-clean.channels.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - CNN International - BBC World News - - diff --git a/tests/__data__/expected/sites/parse-channels.channels.xml b/tests/__data__/expected/sites/parse-channels.channels.xml deleted file mode 100644 index e20ceef3..00000000 --- a/tests/__data__/expected/sites/parse-channels.channels.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - BBC World News - CNN International - - diff --git a/tests/__data__/input/channels-editor/channels-editor.channels.xml b/tests/__data__/input/channels-editor/channels-editor.channels.xml new file mode 100644 index 00000000..dd78c49c --- /dev/null +++ b/tests/__data__/input/channels-editor/channels-editor.channels.xml @@ -0,0 +1,4 @@ + + + CNN International + diff --git a/tests/__data__/input/channels-lint/channels-lint.channels.xml b/tests/__data__/input/channels-lint/channels-lint.channels.xml new file mode 100644 index 00000000..7983d18e --- /dev/null +++ b/tests/__data__/input/channels-lint/channels-lint.channels.xml @@ -0,0 +1,4 @@ + + + CNN International + diff --git a/tests/__data__/input/channels-parse/channels-parse.channels.xml b/tests/__data__/input/channels-parse/channels-parse.channels.xml new file mode 100644 index 00000000..a69639f9 --- /dev/null +++ b/tests/__data__/input/channels-parse/channels-parse.channels.xml @@ -0,0 +1,4 @@ + + + CNN International + diff --git a/tests/__data__/input/sites/parse-channels.config.js b/tests/__data__/input/channels-parse/channels-parse.config.js similarity index 84% rename from tests/__data__/input/sites/parse-channels.config.js rename to tests/__data__/input/channels-parse/channels-parse.config.js index e79ffa4e..4688835f 100644 --- a/tests/__data__/input/sites/parse-channels.config.js +++ b/tests/__data__/input/channels-parse/channels-parse.config.js @@ -1,8 +1,6 @@ module.exports = { site: 'parse-channels.com', - url() { - return `https://parse-channels.com` - }, + url: 'https://parse-channels.com', parser() { return [] }, diff --git a/tests/__data__/input/channels-validate/duplicate.channels.xml b/tests/__data__/input/channels-validate/duplicate.channels.xml new file mode 100644 index 00000000..dcb3635d --- /dev/null +++ b/tests/__data__/input/channels-validate/duplicate.channels.xml @@ -0,0 +1,5 @@ + + + Bravo + Bravo + \ No newline at end of file diff --git a/tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml b/tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml new file mode 100644 index 00000000..efbe406a --- /dev/null +++ b/tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml @@ -0,0 +1,4 @@ + + + CNN International + \ No newline at end of file diff --git a/tests/__data__/input/epg-grab/custom.channels.xml b/tests/__data__/input/epg-grab/custom.channels.xml new file mode 100644 index 00000000..f32419c6 --- /dev/null +++ b/tests/__data__/input/epg-grab/custom.channels.xml @@ -0,0 +1,9 @@ + + + Channel 1 + Channel 2 + Channel 1 + Channel 3 + Channel 4 + Channel 1 + \ No newline at end of file diff --git a/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml b/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml new file mode 100644 index 00000000..7f81064b --- /dev/null +++ b/tests/__data__/input/epg-grab/sites/example.com/example.com.channels.xml @@ -0,0 +1,6 @@ + + + Channel 1 + Channel 2 + Channel 1 + \ No newline at end of file diff --git a/tests/__data__/input/epg-grab/sites/example.com/example.com.config.js b/tests/__data__/input/epg-grab/sites/example.com/example.com.config.js new file mode 100644 index 00000000..51b43a62 --- /dev/null +++ b/tests/__data__/input/epg-grab/sites/example.com/example.com.config.js @@ -0,0 +1,28 @@ +module.exports = { + site: 'example.com', + days: 2, + request: { + timeout: 1000 + }, + url: 'https://example.com', + parser({ channel, date }) { + if (channel.xmltv_id === 'Channel2.us') return [] + else if (channel.xmltv_id === 'Channel1.us' && channel.lang === 'fr') { + return [ + { + title: 'Programme1 (example.com)', + start: `${date.format('YYYY-MM-DD')}T04:30:00.000Z`, + stop: `${date.format('YYYY-MM-DD')}T07:10:00.000Z` + } + ] + } + + return [ + { + title: 'Program1 (example.com)', + start: `${date.format('YYYY-MM-DD')}T04:30:00.000Z`, + stop: `${date.format('YYYY-MM-DD')}T07:10:00.000Z` + } + ] + } +} diff --git a/tests/__data__/input/epg-grab/sites/example2.com/example2.com.channels.xml b/tests/__data__/input/epg-grab/sites/example2.com/example2.com.channels.xml new file mode 100644 index 00000000..821bd29c --- /dev/null +++ b/tests/__data__/input/epg-grab/sites/example2.com/example2.com.channels.xml @@ -0,0 +1,6 @@ + + + Channel 3 + Channel 4 + Channel 1 + \ No newline at end of file diff --git a/tests/__data__/input/epg-grab/sites/example2.com/example2.com.config.js b/tests/__data__/input/epg-grab/sites/example2.com/example2.com.config.js new file mode 100644 index 00000000..68561cc8 --- /dev/null +++ b/tests/__data__/input/epg-grab/sites/example2.com/example2.com.config.js @@ -0,0 +1,23 @@ +module.exports = { + site: 'example2.com', + url: 'https://example2.com', + parser({ channel, date }) { + if (channel.lang === 'fr') { + return [ + { + title: 'Programme1 (example2.com)', + start: `${date.format('YYYY-MM-DD')}T04:40:00.000Z`, + stop: `${date.format('YYYY-MM-DD')}T07:10:00.000Z` + } + ] + } + + return [ + { + title: 'Program1 (example2.com)', + start: `${date.format('YYYY-MM-DD')}T04:30:00.000Z`, + stop: `${date.format('YYYY-MM-DD')}T07:10:00.000Z` + } + ] + } +} diff --git a/tests/__data__/input/sites/duplicate.channels.xml b/tests/__data__/input/sites/duplicate.channels.xml deleted file mode 100644 index deba9dac..00000000 --- a/tests/__data__/input/sites/duplicate.channels.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Bravo - Bravo - - \ No newline at end of file diff --git a/tests/__data__/input/sites/epg-grab/epg-grab.channels.xml b/tests/__data__/input/sites/epg-grab/epg-grab.channels.xml deleted file mode 100644 index 75fa7c3c..00000000 --- a/tests/__data__/input/sites/epg-grab/epg-grab.channels.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Channel 1 - Channel 2 - Channel 1 - - \ No newline at end of file diff --git a/tests/__data__/input/sites/epg-grab/epg-grab.config.js b/tests/__data__/input/sites/epg-grab/epg-grab.config.js deleted file mode 100644 index dca7aeea..00000000 --- a/tests/__data__/input/sites/epg-grab/epg-grab.config.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - site: 'example.com', - days: 1, - request: { - timeout: 1000 - }, - url() { - return `https://example.com` - }, - parser({ channel }) { - if (channel.xmltv_id === 'Channel2.us') return [] - - return [ - { - title: 'Program1', - start: '2022-03-06T04:30:00.000Z', - stop: '2022-03-06T07:10:00.000Z' - } - ] - } -} diff --git a/tests/__data__/input/sites/example.com.config.js b/tests/__data__/input/sites/example.com.config.js deleted file mode 100644 index e420f308..00000000 --- a/tests/__data__/input/sites/example.com.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - site: 'example.com', - days: 2, - url() { - return `https://example.com` - }, - parser() { - return [] - } -} diff --git a/tests/__data__/input/sites/example.com_en.channels.xml b/tests/__data__/input/sites/example.com_en.channels.xml deleted file mode 100644 index 44520703..00000000 --- a/tests/__data__/input/sites/example.com_en.channels.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Channel 1 - Channel 2 - - \ No newline at end of file diff --git a/tests/__data__/input/sites/example.com_ru.channels.xml b/tests/__data__/input/sites/example.com_ru.channels.xml deleted file mode 100644 index fc21be06..00000000 --- a/tests/__data__/input/sites/example.com_ru.channels.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - Channel 1 - - \ No newline at end of file diff --git a/tests/__data__/input/sites/ignore.com.channels.xml b/tests/__data__/input/sites/ignore.com.channels.xml deleted file mode 100644 index ec8ad844..00000000 --- a/tests/__data__/input/sites/ignore.com.channels.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - 1+2 - - \ No newline at end of file diff --git a/tests/__data__/input/sites/ignore.com.config.js b/tests/__data__/input/sites/ignore.com.config.js deleted file mode 100644 index b0058dfc..00000000 --- a/tests/__data__/input/sites/ignore.com.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - site: 'ignore.com', - ignore: true, - url() { - return `https://ignore.com` - }, - parser() { - return [] - } -} diff --git a/tests/__data__/input/sites/lint.channels.xml b/tests/__data__/input/sites/lint.channels.xml deleted file mode 100644 index b85e8b8d..00000000 --- a/tests/__data__/input/sites/lint.channels.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - CNN International - - \ No newline at end of file diff --git a/tests/__data__/input/sites/parse-channels.channels.xml b/tests/__data__/input/sites/parse-channels.channels.xml deleted file mode 100644 index 29f16d4b..00000000 --- a/tests/__data__/input/sites/parse-channels.channels.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - CNN International - - diff --git a/tests/__data__/input/sites/wrong_xmltv_id.channels.xml b/tests/__data__/input/sites/wrong_xmltv_id.channels.xml deleted file mode 100644 index 638ab301..00000000 --- a/tests/__data__/input/sites/wrong_xmltv_id.channels.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - CNN International - - \ No newline at end of file diff --git a/tests/__data__/input/tmp/data/channels.json b/tests/__data__/input/temp/data/channels.json similarity index 100% rename from tests/__data__/input/tmp/data/channels.json rename to tests/__data__/input/temp/data/channels.json diff --git a/tests/__data__/input/tmp/data/countries.json b/tests/__data__/input/temp/data/countries.json similarity index 100% rename from tests/__data__/input/tmp/data/countries.json rename to tests/__data__/input/temp/data/countries.json diff --git a/tests/__data__/input/tmp/data/regions.json b/tests/__data__/input/temp/data/regions.json similarity index 100% rename from tests/__data__/input/tmp/data/regions.json rename to tests/__data__/input/temp/data/regions.json diff --git a/tests/__data__/input/tmp/data/subdivisions.json b/tests/__data__/input/temp/data/subdivisions.json similarity index 100% rename from tests/__data__/input/tmp/data/subdivisions.json rename to tests/__data__/input/temp/data/subdivisions.json