-
Notifications
You must be signed in to change notification settings - Fork 37
/
empty-line-between-blocks.test.mjs
57 lines (48 loc) · 1.04 KB
/
empty-line-between-blocks.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
50
51
52
53
54
55
56
57
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 missing empty line between blocks', () => {
const invalidScss = (
`p {
margin: 0;
em {
color: #f00;
}
}
a {
color: #f00;
}
`);
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, 2);
});
it('correct warning text', () => {
assert.deepEqual(
result.results[0].warnings.map((w) => w.text),
[
'Expected empty line before rule (rule-empty-line-before)',
'Expected empty line before rule (rule-empty-line-before)',
],
);
});
it('correct rule flagged', () => {
assert.deepEqual(
result.results[0].warnings.map((w) => w.rule),
[
'rule-empty-line-before',
'rule-empty-line-before',
],
);
});
});