-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.test.ts
32 lines (26 loc) · 911 Bytes
/
index.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
30
31
32
/**
* @file Tests the index file.
*/
import test from "ava";
import { readdirSync } from "fs";
import plugin from "~/index";
const ruleFiles: ReadonlyArray<string> = readdirSync("./src/rules").filter(
(file) => file !== "index.ts" && file.endsWith(".ts")
);
const configFiles: ReadonlyArray<string> = readdirSync("./src/configs").filter(
(file) => file !== "index.ts" && file.endsWith(".ts")
);
test("should have all the rules", (t) => {
t.true(
Object.prototype.hasOwnProperty.call(plugin, "rules"),
'The plugin\'s config object should have a "rules" property.'
);
t.is(ruleFiles.length, Object.keys(plugin.rules).length);
});
test("should have all the configs", (t) => {
t.true(
Object.prototype.hasOwnProperty.call(plugin, "configs"),
'The plugin\'s config object should have a "configs" property.'
);
t.is(configFiles.length, Object.keys(plugin.configs).length);
});