-
-
Notifications
You must be signed in to change notification settings - Fork 929
/
reportUnknownRuleNames.test.js
62 lines (57 loc) · 1.47 KB
/
reportUnknownRuleNames.test.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"use strict";
const standalone = require("../standalone");
it("test case (1)", () => {
const config = {
rules: {
"color-hex-cas": ["upper"],
"function-whitelst": ["scale"]
}
};
return standalone({
config,
code: "a {}"
}).then(linted => {
expect(linted.results[0].warnings).toHaveLength(2);
expect(linted.results[0].warnings).toContainEqual({
line: 1,
column: 1,
severity: "error",
rule: "color-hex-cas",
text: "Unknown rule color-hex-cas. Did you mean color-hex-case?"
});
expect(linted.results[0].warnings).toContainEqual({
line: 1,
column: 1,
severity: "error",
rule: "function-whitelst",
text: "Unknown rule function-whitelst. Did you mean function-whitelist?"
});
});
});
it("test case (2)", () => {
const config = {
rules: {
"color-hex-case": ["upper"],
"function-whitelst": ["rgb"]
}
};
return standalone({
config,
code: "a { color: #fff; transform: scale(0.7); }"
}).then(linted => {
expect(linted.results[0].warnings).toHaveLength(2);
expect(linted.results[0].warnings).toContainEqual({
line: 1,
column: 1,
severity: "error",
rule: "function-whitelst",
text: "Unknown rule function-whitelst. Did you mean function-whitelist?"
});
expect(linted.results[0].warnings).toContainEqual(
expect.objectContaining({
severity: "error",
rule: "color-hex-case"
})
);
});
});