From 6df18ad468af78dc14e8782cb004a826acacef77 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 27 Feb 2022 18:04:56 +0300 Subject: [PATCH] Create lint.test.js --- tests/commands/channels/lint.test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/commands/channels/lint.test.js diff --git a/tests/commands/channels/lint.test.js b/tests/commands/channels/lint.test.js new file mode 100644 index 00000000..b35728d0 --- /dev/null +++ b/tests/commands/channels/lint.test.js @@ -0,0 +1,19 @@ +const { execSync } = require('child_process') + +fit('will show a message if the file contains a syntax error', () => { + try { + const stdout = execSync( + 'npm run channels:lint -- tests/__data__/input/sites/lint.channels.xml', + { + encoding: 'utf8' + } + ) + console.log(stdout) + process.exit(1) + } catch (err) { + expect(err.status).toBe(1) + expect(err.stdout).toBe( + `\n> channels:lint\n> node scripts/commands/channels/lint.js "tests/__data__/input/sites/lint.channels.xml"\n\n\ntests/__data__/input/sites/lint.channels.xml\n 4:0 Element 'channel': The attribute 'lang' is required but missing.\n\n1 error(s)\n` + ) + } +})