Skip to content

Commit

Permalink
Chore: increase camelcase test coverage (#11299)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedTn authored and ilyavolodin committed Feb 1, 2019
1 parent 5b14ad1 commit 9005e63
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/lib/rules/camelcase.js
Expand Up @@ -202,6 +202,11 @@ ruleTester.run("camelcase", rule, {
{
code: "__option_foo__ = 0;",
options: [{ allow: ["__option_foo__"] }]
},
{
code: "foo = { [computedBar]: 0 };",
options: [{ ignoreDestructuring: true }],
parserOptions: { ecmaVersion: 6 }
}
],
invalid: [
Expand Down Expand Up @@ -295,6 +300,17 @@ ruleTester.run("camelcase", rule, {
}
]
},
{
code: "var foo = { bar_baz: boom.bam_pow }",
options: [{ ignoreDestructuring: true }],
errors: [
{
messageId: "notCamelCase",
data: { name: "bar_baz" },
type: "Identifier"
}
]
},
{
code: "foo.qux.boom_pow = { bar: boom.bam_pow }",
errors: [
Expand Down Expand Up @@ -600,6 +616,16 @@ ruleTester.run("camelcase", rule, {
}
]
},
{
code: "const { no_camelcased = foo_bar } = bar;",
parserOptions: { ecmaVersion: 6 },
errors: [
{
message: "Identifier 'no_camelcased' is not in camel case.",
type: "Identifier"
}
]
},
{
code: "not_ignored_foo = 0;",
options: [{ allow: ["ignored_bar"] }],
Expand All @@ -619,6 +645,17 @@ ruleTester.run("camelcase", rule, {
type: "Identifier"
}
]
},
{
code: "foo = { [computed_bar]: 0 };",
options: [{ ignoreDestructuring: true }],
parserOptions: { ecmaVersion: 6 },
errors: [
{
message: "Identifier 'computed_bar' is not in camel case.",
type: "Identifier"
}
]
}
]
});

0 comments on commit 9005e63

Please sign in to comment.