forked from jest-community/eslint-plugin-jest
/
rules.test.ts
29 lines (25 loc) · 854 Bytes
/
rules.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { existsSync } from 'fs';
import { resolve } from 'path';
import plugin from '../';
const ruleNames = Object.keys(plugin.rules);
const numberOfRules = 41;
describe('rules', () => {
it('should have a corresponding doc for each rule', () => {
ruleNames.forEach(rule => {
const docPath = resolve(__dirname, '../../docs/rules', `${rule}.md`);
if (!existsSync(docPath)) {
throw new Error(
`Could not find documentation file for rule "${rule}" in path "${docPath}"`,
);
}
});
});
it('should have the correct amount of rules', () => {
const { length } = ruleNames;
if (length !== numberOfRules) {
throw new Error(
`There should be exactly ${numberOfRules} rules, but there are ${length}. If you've added a new rule, please update this number.`,
);
}
});
});