This commit is contained in:
Aleksandr Statciuk 2022-02-07 02:27:15 +03:00
parent bad3eddf9d
commit 86e0c2f7da
31 changed files with 611 additions and 698 deletions

View file

@ -1,5 +1,6 @@
const fs = require('fs-extra')
const path = require('path')
const glob = require('glob')
const { execSync } = require('child_process')
beforeEach(() => {
@ -19,33 +20,22 @@ beforeEach(() => {
})
it('can generate playlists', () => {
const files = [
'.gh-pages/categories/general.m3u',
'.gh-pages/categories/legislative.m3u',
'.gh-pages/categories/news.m3u',
'.gh-pages/categories/undefined.m3u',
'logs/generators/categories.log',
'.gh-pages/countries/ru.m3u',
'.gh-pages/countries/uk.m3u',
'.gh-pages/countries/undefined.m3u',
'logs/generators/countries.log',
'.gh-pages/languages/cat.m3u',
'.gh-pages/languages/eng.m3u',
'.gh-pages/languages/nld.m3u',
'.gh-pages/languages/rus.m3u',
'.gh-pages/languages/undefined.m3u',
'logs/generators/languages.log',
'.gh-pages/regions/asia.m3u',
'.gh-pages/regions/cis.m3u',
'.gh-pages/regions/emea.m3u',
'.gh-pages/regions/eur.m3u',
'.gh-pages/regions/int.m3u',
'.gh-pages/regions/undefined.m3u',
'logs/generators/regions.log'
]
const files = glob
.sync('tests/__data__/expected/.gh-pages/**/*.m3u')
.map(f => f.replace('tests/__data__/expected/', ''))
files.forEach(filepath => {
expect(content(`output/${filepath}`)).toBe(content(`expected/${filepath}`))
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
})
})
it('can generate logs', () => {
const files = glob
.sync('tests/__data__/expected/logs/generators/*.log')
.map(f => f.replace('tests/__data__/expected/', ''))
files.forEach(filepath => {
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
})
})