-
Notifications
You must be signed in to change notification settings - Fork 37
/
color-named.test.mjs
49 lines (40 loc) · 896 Bytes
/
color-named.test.mjs
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
import { beforeEach, describe, it } from 'node:test';
import assert from 'node:assert/strict';
import stylelint from 'stylelint';
import config from '../index.js';
describe('flags warnings with color-named lint', () => {
const invalidScss = (
`.test-selector {
color: green;
}
`);
let result;
beforeEach(async () => {
result = await stylelint.lint({
code: invalidScss,
config,
});
});
it('did error', () => {
assert.equal(result.errored, true);
});
it('flags warnings', () => {
assert.equal(result.results[0].warnings.length, 1);
});
it('correct warning text', () => {
assert.deepEqual(
result.results[0].warnings.map((w) => w.text),
[
'Unexpected named color "green" (color-named)',
],
);
});
it('correct rule flagged', () => {
assert.deepEqual(
result.results[0].warnings.map((w) => w.rule),
[
'color-named',
],
);
});
});