Skip to content

Commit

Permalink
[Tests] no-unused-modules: fix formatting; add test case from #1844
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 3, 2020
1 parent a5a277f commit 843055c
Showing 1 changed file with 47 additions and 19 deletions.
66 changes: 47 additions & 19 deletions tests/src/rules/no-unused-modules.js
Expand Up @@ -37,25 +37,53 @@ const unusedExportsJsxOptions = [{
// tests for missing exports
ruleTester.run('no-unused-modules', rule, {
valid: [
test({ code: 'export default function noOptions() {}' }),
test({ options: missingExportsOptions,
code: 'export default () => 1'}),
test({ options: missingExportsOptions,
code: 'export const a = 1'}),
test({ options: missingExportsOptions,
code: 'const a = 1; export { a }'}),
test({ options: missingExportsOptions,
code: 'function a() { return true }; export { a }'}),
test({ options: missingExportsOptions,
code: 'const a = 1; const b = 2; export { a, b }'}),
test({ options: missingExportsOptions,
code: 'const a = 1; export default a'}),
test({ options: missingExportsOptions,
code: 'export class Foo {}'}),
test({ options: missingExportsOptions,
code: 'export const [foobar] = [];'}),
test({ options: missingExportsOptions,
code: 'export const [foobar] = foobarFactory();'}),
test({
code: 'export default function noOptions() {}',
}),
test({
options: missingExportsOptions,
code: 'export default () => 1',
}),
test({
options: missingExportsOptions,
code: 'export const a = 1',
}),
test({
options: missingExportsOptions,
code: 'const a = 1; export { a }',
}),
test({
options: missingExportsOptions,
code: 'function a() { return true }; export { a }',
}),
test({
options: missingExportsOptions,
code: 'const a = 1; const b = 2; export { a, b }',
}),
test({
options: missingExportsOptions,
code: 'const a = 1; export default a',
}),
test({
options: missingExportsOptions,
code: 'export class Foo {}',
}),
test({
options: missingExportsOptions,
code: 'export const [foobar] = [];',
}),
test({
options: missingExportsOptions,
code: 'export const [foobar] = foobarFactory();',
}),
test({
options: missingExportsOptions,
code: `
export default function NewComponent () {
return 'I am new component'
}
`,
}),
],
invalid: [
test({
Expand Down

0 comments on commit 843055c

Please sign in to comment.