summaryrefslogtreecommitdiff
path: root/test/parallel/test-eslint-alphabetize-errors.js
diff options
context:
space:
mode:
authorTeddy Katz <teddy.katz@gmail.com>2017-10-11 01:42:47 -0400
committerTeddy Katz <teddy.katz@gmail.com>2017-10-14 02:53:19 -0400
commitcd5ee52d70889a39f8251eb7d49f8063f96f2d8c (patch)
treeb71c5390e7b254c1d1a1af2c031033bc63f2fb1f /test/parallel/test-eslint-alphabetize-errors.js
parent34c47ed4867e0bbde3ad55557bd265238d4ac91f (diff)
downloadandroid-node-v8-cd5ee52d70889a39f8251eb7d49f8063f96f2d8c.tar.gz
android-node-v8-cd5ee52d70889a39f8251eb7d49f8063f96f2d8c.tar.bz2
android-node-v8-cd5ee52d70889a39f8251eb7d49f8063f96f2d8c.zip
test: add tests for eslint rules
This adds tests for the custom eslint rules in this repository, using the `RuleTester` test utility bundled with eslint. PR-URL: https://github.com/nodejs/node/pull/16138 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-eslint-alphabetize-errors.js')
-rw-r--r--test/parallel/test-eslint-alphabetize-errors.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/parallel/test-eslint-alphabetize-errors.js b/test/parallel/test-eslint-alphabetize-errors.js
new file mode 100644
index 0000000000..83c73fc78c
--- /dev/null
+++ b/test/parallel/test-eslint-alphabetize-errors.js
@@ -0,0 +1,26 @@
+'use strict';
+
+require('../common');
+
+const RuleTester = require('../../tools/eslint').RuleTester;
+const rule = require('../../tools/eslint-rules/alphabetize-errors');
+
+new RuleTester().run('alphabetize-errors', rule, {
+ valid: [
+ `
+ E('AAA', 'foo');
+ E('BBB', 'bar');
+ E('CCC', 'baz');
+ `
+ ],
+ invalid: [
+ {
+ code: `
+ E('BBB', 'bar');
+ E('AAA', 'foo');
+ E('CCC', 'baz');
+ `,
+ errors: [{ message: 'Out of ASCIIbetical order - BBB >= AAA', line: 3 }]
+ }
+ ]
+});