mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update load-cluster.js
This commit is contained in:
parent
4ec3e35845
commit
642b09051f
2 changed files with 17 additions and 8 deletions
|
@ -56,9 +56,9 @@ async function main() {
|
|||
if (err) logger.error(err.message)
|
||||
|
||||
const result = {
|
||||
_id: channel._id,
|
||||
logo: data.channel.logo,
|
||||
channel: data.channel,
|
||||
programs: data.programs,
|
||||
date: data.date.format(),
|
||||
error: err ? err.message : null
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
beforeEach(() => {
|
||||
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
||||
|
@ -21,17 +25,22 @@ beforeEach(() => {
|
|||
it('can load cluster', () => {
|
||||
const output = content('tests/__data__/output/logs/load-cluster/cluster_1.log')
|
||||
|
||||
expect(Object.keys(output[0]).sort()).toEqual(['channel', 'date', 'error', 'programs'])
|
||||
|
||||
expect(output[0]).toMatchObject({
|
||||
_id: '0Wefq0oMR3feCcuY',
|
||||
logo: 'https://example.com/logo.png',
|
||||
channel: {
|
||||
_id: '0Wefq0oMR3feCcuY',
|
||||
logo: 'https://example.com/logo.png'
|
||||
},
|
||||
date: dayjs.utc().startOf('d').format(),
|
||||
error: null
|
||||
})
|
||||
|
||||
expect(Object.keys(output[0]).sort()).toEqual(['_id', 'error', 'logo', 'programs'])
|
||||
|
||||
expect(output[1]).toMatchObject({
|
||||
_id: '1XzrxNkSF2AQNBrT',
|
||||
logo: 'https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg'
|
||||
channel: {
|
||||
_id: '1XzrxNkSF2AQNBrT',
|
||||
logo: 'https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue