From 33e58da0ef4fbede3ec92cc303fc094d6994bf96 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Mon, 28 Jul 2025 04:37:12 +0300 Subject: [PATCH] Update validate.test.ts --- tests/commands/channels/validate.test.ts | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/commands/channels/validate.test.ts b/tests/commands/channels/validate.test.ts index 31be169d..79e6ce30 100644 --- a/tests/commands/channels/validate.test.ts +++ b/tests/commands/channels/validate.test.ts @@ -29,14 +29,9 @@ describe('channels:validate', () => { }) it('will show a message if the file contains a channel with wrong channel id', () => { - try { - const cmd = `${ENV_VAR} npm run channels:validate --- tests/__data__/input/channels_validate/wrong_channel_id.channels.xml` - const stdout = execSync(cmd, { encoding: 'utf8' }) - if (process.env.DEBUG === 'true') console.log(cmd, stdout) - process.exit(1) - } catch (error) { - expect((error as ExecError).status).toBe(1) - expect((error as ExecError).stdout).toContain(` + const cmd = `${ENV_VAR} npm run channels:validate --- tests/__data__/input/channels_validate/wrong_channel_id.channels.xml` + const stdout = execSync(cmd, { encoding: 'utf8' }) + expect(stdout).toContain(` ┌─────────┬────────────────────┬──────┬────────────────────┬─────────┬─────────────────────┐ │ (index) │ type │ lang │ xmltv_id │ site_id │ name │ ├─────────┼────────────────────┼──────┼────────────────────┼─────────┼─────────────────────┤ @@ -45,18 +40,12 @@ describe('channels:validate', () => { 1 problems (0 errors, 1 warnings) in 1 file(s) `) - } }) it('will show a message if the file contains a channel with wrong feed id', () => { - try { - const cmd = `${ENV_VAR} npm run channels:validate --- tests/__data__/input/channels_validate/wrong_feed_id.channels.xml` - const stdout = execSync(cmd, { encoding: 'utf8' }) - if (process.env.DEBUG === 'true') console.log(cmd, stdout) - process.exit(1) - } catch (error) { - expect((error as ExecError).status).toBe(1) - expect((error as ExecError).stdout).toContain(` + const cmd = `${ENV_VAR} npm run channels:validate --- tests/__data__/input/channels_validate/wrong_feed_id.channels.xml` + const stdout = execSync(cmd, { encoding: 'utf8' }) + expect(stdout).toContain(` ┌─────────┬─────────────────┬──────┬─────────────────┬─────────┬─────────┐ │ (index) │ type │ lang │ xmltv_id │ site_id │ name │ ├─────────┼─────────────────┼──────┼─────────────────┼─────────┼─────────┤ @@ -65,6 +54,5 @@ describe('channels:validate', () => { 1 problems (0 errors, 1 warnings) in 1 file(s) `) - } }) })