Update create-queue.js

This commit is contained in:
Aleksandr Statciuk 2022-01-30 22:55:48 +03:00
parent 62e79d982c
commit ca3913f357
5 changed files with 47 additions and 15 deletions

View file

@ -1,2 +1,4 @@
{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","name":"CNN International Europe 2","site":"example.com","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ca-nl/example.com"],"cluster_id":1,"_id":"Q1l5y46bT530JS2z"}
{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","name":"CNN International Europe","site":"example.com","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ca-nl/example.com"],"cluster_id":1,"_id":"auE4QTbPiCEcHyf5"}
{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","site":"example.com","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"cluster_id":1,"_id":"c4pT2p7Q4aBVh13M"}
{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","site":"example.com","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"cluster_id":1,"_id":"POYAcMssTAgZu4Yk"}
{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"cluster_id":1,"_id":"TYDwYLsrkmPtTLT2"}
{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"cluster_id":1,"_id":"98cKRthEhMmKEnwx"}

View file

@ -7,7 +7,7 @@ beforeEach(() => {
fs.mkdirSync('tests/__data__/output')
const stdout = execSync(
'DB_DIR=tests/__data__/output/database node scripts/commands/create-queue.js --channels=tests/__data__/input/sites/*.channels.xml --max-clusters=1',
'DB_DIR=tests/__data__/output/database node scripts/commands/create-queue.js --channels=tests/__data__/input/sites/*.channels.xml --max-clusters=1 --days=2',
{ encoding: 'utf8' }
)
})
@ -18,17 +18,21 @@ it('can create queue', () => {
output = output.map(i => {
i._id = null
i.date = null
return i
})
expected = expected.map(i => {
i._id = null
i.date = null
return i
})
expect(output).toEqual(
expect.arrayContaining([
expect.objectContaining(expected[0]),
expect.objectContaining(expected[1])
expect.objectContaining(expected[1]),
expect.objectContaining(expected[2]),
expect.objectContaining(expected[3])
])
)
})