From bb36840b72b10a2362226a94d2939761720844ac Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Fri, 3 Jan 2025 11:52:50 +0300 Subject: [PATCH] Update lint.test.ts --- tests/commands/channels/lint.test.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/commands/channels/lint.test.ts b/tests/commands/channels/lint.test.ts index 4e37d7a9..d9037663 100644 --- a/tests/commands/channels/lint.test.ts +++ b/tests/commands/channels/lint.test.ts @@ -9,13 +9,27 @@ describe('channels:lint', () => { it('will show a message if the file contains a syntax error', () => { try { const cmd = - 'npm run channels:lint --- --channels=tests/__data__/input/channels-lint/channels-lint.channels.xml' + 'npm run channels:lint --- --channels=tests/__data__/input/channels-lint/error.channels.xml' execSync(cmd, { encoding: 'utf8' }) process.exit(1) } catch (error) { expect((error as ExecError).status).toBe(1) expect((error as ExecError).stdout).toContain( - "channels-lint.channels.xml\n 3:0 Element 'channel': The attribute 'lang' is required but missing.\n\n1 error(s)\n" + "error.channels.xml\n 3:0 Element 'channel': The attribute 'lang' is required but missing.\n\n1 error(s)\n" + ) + } + }) + + it('will show a message if an error occurred while parsing an xml file', () => { + try { + const cmd = + 'npm run channels:lint --- --channels=tests/__data__/input/channels-lint/invalid.channels.xml' + execSync(cmd, { encoding: 'utf8' }) + process.exit(1) + } catch (error) { + expect((error as ExecError).status).toBe(1) + expect((error as ExecError).stdout).toContain( + 'invalid.channels.xml\n 2:6 XML declaration allowed only at the start of the document\n' ) } })