Skip to content

Commit

Permalink
test: add more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Dec 12, 2021
1 parent 50ebee3 commit edb4d2b
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions tests/lib/rules/id-match.js
Expand Up @@ -662,6 +662,8 @@ ruleTester.run("id-match", rule, {
let b = {id: 1};
let c = Object.keys(b);
let d = Array.from(b);
let e = (Object) => Object.keys(obj, prop); // not global Object
let f = (Array) => Array.from(obj, prop); // not global Array
`,
options: ["^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$", {
properties: true
Expand All @@ -670,11 +672,39 @@ ruleTester.run("id-match", rule, {
errors: [
{
message: "Identifier 'foo_variable' does not match the pattern '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$'.",
type: "Identifier"
type: "Identifier",
line: 2,
column: 19
},
{
message: "Identifier 'MyClass' does not match the pattern '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$'.",
type: "Identifier"
type: "Identifier",
line: 3,
column: 19
},
{
message: "Identifier 'Object' does not match the pattern '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$'.",
type: "Identifier",
line: 9,
column: 22
},
{
message: "Identifier 'Object' does not match the pattern '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$'.",
type: "Identifier",
line: 9,
column: 33
},
{
message: "Identifier 'Array' does not match the pattern '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$'.",
type: "Identifier",
line: 10,
column: 22
},
{
message: "Identifier 'Array' does not match the pattern '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$'.",
type: "Identifier",
line: 10,
column: 32
}
]
},
Expand Down

0 comments on commit edb4d2b

Please sign in to comment.