Update bin.test.js

This commit is contained in:
Aleksandr Statciuk 2023-01-10 11:20:29 +03:00
parent ce4914d9e2
commit c2ea8c7996
1 changed files with 9 additions and 9 deletions

View File

@ -12,18 +12,18 @@ function stdoutResultTester(stdout) {
} }
it('can load config', () => { it('can load config', () => {
const result = execSync( const stdout = execSync(
`node ${pwd}/bin/epg-grabber.js --config=tests/__data__/input/example.config.js --delay=0`, `node ${pwd}/bin/epg-grabber.js --config=tests/__data__/input/example.config.js --delay=0`,
{ {
encoding: 'utf8' encoding: 'utf8'
} }
) )
expect(stdoutResultTester(result)).toBe(true) expect(stdoutResultTester(stdout)).toBe(true)
}) })
it('can load mini config', () => { it('can load mini config', () => {
const result = execSync( const stdout = execSync(
`node ${pwd}/bin/epg-grabber.js \ `node ${pwd}/bin/epg-grabber.js \
--config=tests/__data__/input/mini.config.js \ --config=tests/__data__/input/mini.config.js \
--channels=tests/__data__/input/example.channels.xml \ --channels=tests/__data__/input/example.channels.xml \
@ -38,14 +38,14 @@ it('can load mini config', () => {
} }
) )
expect(stdoutResultTester(result)).toBe(true) expect(stdoutResultTester(stdout)).toBe(true)
expect(result.includes("File 'tests/__data__/output/mini.guide.xml' successfully saved")).toBe( expect(stdout.includes("File 'tests/__data__/output/mini.guide.xml' successfully saved")).toBe(
true true
) )
}) })
it('can generate gzip version', () => { it('can generate gzip version', () => {
const result = execSync( const stdout = execSync(
`node ${pwd}/bin/epg-grabber.js \ `node ${pwd}/bin/epg-grabber.js \
--config=tests/__data__/input/mini.config.js \ --config=tests/__data__/input/mini.config.js \
--channels=tests/__data__/input/example.channels.xml \ --channels=tests/__data__/input/example.channels.xml \
@ -56,14 +56,14 @@ it('can generate gzip version', () => {
} }
) )
expect(stdoutResultTester(result)).toBe(true) expect(stdoutResultTester(stdout)).toBe(true)
expect(result.includes("File 'tests/__data__/output/mini.guide.xml.gz' successfully saved")).toBe( expect(stdout.includes("File 'tests/__data__/output/mini.guide.xml.gz' successfully saved")).toBe(
true true
) )
}) })
it('removes duplicates of the program', () => { it('removes duplicates of the program', () => {
const result = execSync( const stdout = execSync(
`node ${pwd}/bin/epg-grabber.js \ `node ${pwd}/bin/epg-grabber.js \
--config=tests/__data__/input/duplicates.config.js \ --config=tests/__data__/input/duplicates.config.js \
--channels=tests/__data__/input/example.channels.xml \ --channels=tests/__data__/input/example.channels.xml \