From f2057dd0157a81c001063a669b577c2f0c74f8ce Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Fri, 30 Jun 2023 14:41:19 +0300 Subject: [PATCH] Update parse.test.js --- tests/commands/channels/parse.test.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/commands/channels/parse.test.js b/tests/commands/channels/parse.test.js index bc82251c..a9242a4f 100644 --- a/tests/commands/channels/parse.test.js +++ b/tests/commands/channels/parse.test.js @@ -4,19 +4,34 @@ const path = require('path') beforeEach(() => { fs.emptyDirSync('tests/__data__/output') - - const stdout = execSync( - 'npm run channels:parse -- --config=tests/__data__/input/sites/parse-channels.config.js --output=tests/__data__/output/channels.xml', - { encoding: 'utf8' } + fs.copySync( + 'tests/__data__/input/sites/parse-channels.channels.xml', + 'tests/__data__/output/channels.xml' ) }) it('can parse channels', () => { + const stdout = execSync( + 'npm run channels:parse -- --config=tests/__data__/input/sites/parse-channels.config.js --output=tests/__data__/output/channels.xml', + { encoding: 'utf8' } + ) + expect(content('tests/__data__/output/channels.xml')).toEqual( content('tests/__data__/expected/sites/parse-channels.channels.xml') ) }) +it('can parse channels with clean flag', () => { + const stdout = execSync( + 'npm run channels:parse -- --config=tests/__data__/input/sites/parse-channels.config.js --output=tests/__data__/output/channels.xml --clean', + { encoding: 'utf8' } + ) + + expect(content('tests/__data__/output/channels.xml')).toEqual( + content('tests/__data__/expected/sites/parse-channels-clean.channels.xml') + ) +}) + function content(filepath) { return fs.readFileSync(path.resolve(filepath), { encoding: 'utf8'