Update load-cluster.js

This commit is contained in:
Aleksandr Statciuk 2022-01-21 19:25:50 +03:00
parent 4ec3e35845
commit 642b09051f
2 changed files with 17 additions and 8 deletions

View file

@ -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'
}
})
})