mirror of
https://git.proxmox.com/git/pve-eslint
synced 2025-08-23 13:36:11 +00:00

includes a (minimal) working wrapper Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
/**
|
|
* @fileoverview Tests for no-div-regex rule.
|
|
* @author Matt DuVall <http://www.mattduvall.com>
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Requirements
|
|
//------------------------------------------------------------------------------
|
|
|
|
const rule = require("../../../lib/rules/no-div-regex"),
|
|
{ RuleTester } = require("../../../lib/rule-tester");
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Tests
|
|
//------------------------------------------------------------------------------
|
|
|
|
const ruleTester = new RuleTester();
|
|
|
|
ruleTester.run("no-div-regex", rule, {
|
|
valid: [
|
|
"var f = function() { return /foo/ig.test('bar'); };",
|
|
"var f = function() { return /\\=foo/; };"
|
|
],
|
|
invalid: [
|
|
{
|
|
code: "var f = function() { return /=foo/; };",
|
|
output: "var f = function() { return /[=]foo/; };",
|
|
errors: [{ messageId: "unexpected", type: "Literal" }]
|
|
}
|
|
]
|
|
});
|