mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update create-queue.test.js
This commit is contained in:
parent
f147a74e44
commit
34eef8f525
3 changed files with 10 additions and 6 deletions
|
@ -1,4 +1,2 @@
|
||||||
{"channel":{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"c4pT2p7Q4aBVh13M"}
|
|
||||||
{"channel":{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"POYAcMssTAgZu4Yk"}
|
|
||||||
{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"TYDwYLsrkmPtTLT2"}
|
{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"TYDwYLsrkmPtTLT2"}
|
||||||
{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"98cKRthEhMmKEnwx"}
|
{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"98cKRthEhMmKEnwx"}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{"xmltv_id":"CNNInternationalEurope2.us","site":"example.com","site_id":"141","lang":"en","error":"Wrong channel ID"}
|
|
@ -7,7 +7,7 @@ beforeEach(() => {
|
||||||
fs.mkdirSync('tests/__data__/output')
|
fs.mkdirSync('tests/__data__/output')
|
||||||
|
|
||||||
const stdout = execSync(
|
const stdout = execSync(
|
||||||
'DB_DIR=tests/__data__/output/database CHANNELS_PATH=tests/__data__/input/sites/*.channels.xml node scripts/commands/create-queue.js --max-clusters=1 --days=2',
|
'DB_DIR=tests/__data__/output/database LOGS_DIR=tests/__data__/output/logs CHANNELS_PATH=tests/__data__/input/sites/*.channels.xml node scripts/commands/create-queue.js --max-clusters=1 --days=2',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -30,13 +30,18 @@ it('can create queue', () => {
|
||||||
expect(output).toEqual(
|
expect(output).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
expect.objectContaining(expected[0]),
|
expect.objectContaining(expected[0]),
|
||||||
expect.objectContaining(expected[1]),
|
expect.objectContaining(expected[1])
|
||||||
expect.objectContaining(expected[2]),
|
|
||||||
expect.objectContaining(expected[3])
|
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('can create errors log', () => {
|
||||||
|
let output = content('tests/__data__/output/logs/errors/ca-nl/example.com.log')
|
||||||
|
let expected = content('tests/__data__/expected/logs/errors/ca-nl/example.com.log')
|
||||||
|
|
||||||
|
expect(output).toEqual(expected)
|
||||||
|
})
|
||||||
|
|
||||||
function content(filepath) {
|
function content(filepath) {
|
||||||
const data = fs.readFileSync(path.resolve(filepath), {
|
const data = fs.readFileSync(path.resolve(filepath), {
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue