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)
|
if (err) logger.error(err.message)
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
_id: channel._id,
|
channel: data.channel,
|
||||||
logo: data.channel.logo,
|
|
||||||
programs: data.programs,
|
programs: data.programs,
|
||||||
|
date: data.date.format(),
|
||||||
error: err ? err.message : null
|
error: err ? err.message : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
const { execSync } = require('child_process')
|
const { execSync } = require('child_process')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||||
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
||||||
|
@ -21,17 +25,22 @@ beforeEach(() => {
|
||||||
it('can load cluster', () => {
|
it('can load cluster', () => {
|
||||||
const output = content('tests/__data__/output/logs/load-cluster/cluster_1.log')
|
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({
|
expect(output[0]).toMatchObject({
|
||||||
|
channel: {
|
||||||
_id: '0Wefq0oMR3feCcuY',
|
_id: '0Wefq0oMR3feCcuY',
|
||||||
logo: 'https://example.com/logo.png',
|
logo: 'https://example.com/logo.png'
|
||||||
|
},
|
||||||
|
date: dayjs.utc().startOf('d').format(),
|
||||||
error: null
|
error: null
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(Object.keys(output[0]).sort()).toEqual(['_id', 'error', 'logo', 'programs'])
|
|
||||||
|
|
||||||
expect(output[1]).toMatchObject({
|
expect(output[1]).toMatchObject({
|
||||||
|
channel: {
|
||||||
_id: '1XzrxNkSF2AQNBrT',
|
_id: '1XzrxNkSF2AQNBrT',
|
||||||
logo: 'https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg'
|
logo: 'https://www.magticom.ge/images/channels/MjAxOC8wOS8xMC9lZmJhNWU5Yy0yMmNiLTRkMTAtOWY5Ny01ODM0MzY0ZTg0MmEuanBn.jpg'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue