From b2e1793c95c6343a607705d6b36d90a2426f15b5 Mon Sep 17 00:00:00 2001 From: guylil Date: Mon, 20 Nov 2017 21:16:49 +0200 Subject: [PATCH] camelcase failing test case --- tests/lib/rules/camelcase.js | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/lib/rules/camelcase.js diff --git a/tests/lib/rules/camelcase.js b/tests/lib/rules/camelcase.js new file mode 100644 index 0000000..aa3b750 --- /dev/null +++ b/tests/lib/rules/camelcase.js @@ -0,0 +1,45 @@ +/** + * @fileoverview Tests for camelcase rule + * @author Guy Lilian & Shahar Or + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const ruleCamelcase = require("eslint/lib/rules/camelcase"); +const RuleTester = require("eslint").RuleTester; + +const parser = "typescript-eslint-parser"; + +const ruleTester = new RuleTester(); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +ruleTester.run("camelcase", ruleCamelcase, { + valid: [ + { + code: "interface Foo { b_ar: null }", + parser, + options: [{ properties: "never" }] + } + ], + + invalid: [ + { + code: "interface Foo { b_ar: null }", + parser, + options: [{ properties: "always" }], + errors: [ + { + message: "Identifier 'b_ar' is not in camel case.", + line: 1, + column: 17 + } + ] + } + ] +});