Skip to content

Commit

Permalink
test: ensure rule test file has correct test suite name
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Oct 29, 2020
1 parent 16f2486 commit f3eca4c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ruleTester = new RuleTester({
sourceType: 'module',
},
});
ruleTester.run('no-anonymous-functions-to-single-scheduler-methods', rule, {
ruleTester.run('no-incorrect-calls-with-inline-anonymous-functions', rule, {
valid: [
`
import { once, scheduleOnce, debounce } from '@ember/runloop';
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/no-test-import-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ruleTester = new RuleTester({
const NO_IMPORT_MESSAGE = rule.meta.importMessage;
const NO_EXPORT_MESSAGE = rule.meta.exportMessage;

ruleTester.run('no-test-file-importing', rule, {
ruleTester.run('no-test-import-export', rule, {
valid: [
`
import setupModule from './some-test-helper';
Expand Down
14 changes: 14 additions & 0 deletions tests/rule-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ describe('rules setup is correct', function () {
);
});

describe('test files', function () {
RULE_NAMES.forEach((ruleName) => {
const filePath = path.join(__dirname, '..', 'tests', 'lib', 'rules', `${ruleName}.js`);
const file = readFileSync(filePath, 'utf8');

// eslint-disable-next-line jest/valid-title
describe(ruleName, function () {
it('should have the right test suite name', function () {
expect(file).toContain(`.run('${ruleName}'`);
});
});
});
});

it('should have documentation for all rules', function () {
const filePath = path.join(__dirname, '..', 'docs', 'rules');
const files = readdirSync(filePath);
Expand Down

0 comments on commit f3eca4c

Please sign in to comment.