]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/lib/rules/no-ternary.js
2 * @fileoverview Tests for no-ternary.
3 * @author Ian Christian Myers
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 const rule
= require("../../../lib/rules/no-ternary"),
13 { RuleTester
} = require("../../../lib/rule-tester");
15 //------------------------------------------------------------------------------
17 //------------------------------------------------------------------------------
19 const ruleTester
= new RuleTester();
21 ruleTester
.run("no-ternary", rule
, {
26 { code
: "var foo = true ? thing : stuff;", errors
: [{ messageId
: "noTernaryOperator", type
: "ConditionalExpression" }] },
27 { code
: "true ? thing() : stuff();", errors
: [{ messageId
: "noTernaryOperator", type
: "ConditionalExpression" }] },
28 { code
: "function foo(bar) { return bar ? baz : qux; }", errors
: [{ messageId
: "noTernaryOperator", type
: "ConditionalExpression" }] }