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 16, 2021
1 parent 10215e6 commit 694e90c
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions tests/lib/rules/id-match.js
Expand Up @@ -197,6 +197,46 @@ ruleTester.run("id-match", rule, {
}],
parserOptions: { ecmaVersion: 2022 }
},
{
code: `
const foo = {
foo_one: 1,
bar_one: 2,
fooBar: 3
};
`,
options: ["^[^_]+$", {
properties: false
}],
parserOptions: { ecmaVersion: 2022 }
},
{
code: `
const foo = {
foo_one: 1,
bar_one: 2,
fooBar: 3
};
`,
options: ["^[^_]+$", {
onlyDeclarations: true
}],
parserOptions: { ecmaVersion: 2022 }
},
{
code: `
const foo = {
foo_one: 1,
bar_one: 2,
fooBar: 3
};
`,
options: ["^[^_]+$", {
properties: false,
onlyDeclarations: true
}],
parserOptions: { ecmaVersion: 2022 }
},

// Class Methods
{
Expand Down Expand Up @@ -800,6 +840,30 @@ ruleTester.run("id-match", rule, {
type: "Identifier"
}
]
},
{
code: `
const foo = {
foo_one: 1,
bar_one: 2,
fooBar: 3
};
`,
options: ["^[^_]+$", {
properties: true,
onlyDeclarations: false
}],
parserOptions: { ecmaVersion: 2022 },
errors: [
{
message: "Identifier 'foo_one' does not match the pattern '^[^_]+$'.",
type: "Identifier"
},
{
message: "Identifier 'bar_one' does not match the pattern '^[^_]+$'.",
type: "Identifier"
}
]
}
]
});

0 comments on commit 694e90c

Please sign in to comment.