Skip to content

Commit

Permalink
test(camelcase): increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
RedTn committed Jan 21, 2019
1 parent faf3c4e commit b463091
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/lib/rules/camelcase.js
Original file line number Diff line number Diff line change
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 b463091

Please sign in to comment.