Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 33bbb45

Browse files
committed
test: "Code test" enough?
1 parent 3a555df commit 33bbb45

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

test/expected.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ div {
33
position: relative;
44
flex: auto;
55
display: flex;
6-
box-sizing: border-box;
6+
flex-direction: column;
77
block-size: 100%;
8-
font-size: 0.625rem;
9-
cursor: pointer;
10-
background-color: #fff;
11-
transition: all 0.5s ease-in-out;
8+
font: 1rem / 1.5 sans-serif;
9+
background: #fff;
10+
overflow: auto;
11+
transform: scale(2);
1212
}

test/fixture.css

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
div {
2+
all: revert;
23
position: relative;
3-
box-sizing: border-box;
44
display: flex;
5+
flex-direction: column;
56
flex: auto;
67
block-size: 100%;
7-
font-size: 0.625rem;
8-
cursor: pointer;
9-
background-color: #fff;
10-
transition: all 0.5s ease-in-out;
11-
all: revert;
8+
font: 1rem / 1.5 sans-serif;
9+
background: #fff;
10+
overflow: auto;
11+
transform: scale(2);
1212
}

test/index.test.js

+7-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const stylelint = require("stylelint");
33

44
const randomOrder = require("../index.js");
55
const [fixture, expected] = ["test/fixture.css", "test/expected.css"];
6-
const intentionalwrong = 3;
6+
const intentionalWrong = 1;
77

88
const runStylelint = async (css) => {
99
const { results } = await stylelint.lint({
@@ -13,31 +13,26 @@ const runStylelint = async (css) => {
1313
return results[0];
1414
};
1515

16-
describe("Code lint complement", () => {
16+
describe("Code lint plus", () => {
1717
it("no repeat properties", () => {
18-
const props = [];
18+
const properties = [];
1919
for (const groups of randomOrder.rules["order/properties-order"]) {
20-
props.push(...groups.properties);
20+
properties.push(...groups.properties);
2121
}
22-
assert.equal(new Set(props).size, props.length);
22+
assert.equal(new Set(properties).size, properties.length);
2323
});
2424
});
2525

2626
// stylelint test/*.css --config index.js --max-warnings 0
2727
describe("Code test", () => {
2828
it("with incorrect order", async () => {
2929
const results = await runStylelint(fixture);
30-
assert.ok(results.errored);
31-
assert.equal(results.warnings.length, intentionalwrong);
32-
assert.equal(
33-
results.warnings[0].text.trim(),
34-
`Expected "display" to come before "box-sizing" (order/properties-order)`
35-
);
30+
assert.equal(results.warnings.length, intentionalWrong);
31+
console.log(results.warnings);
3632
});
3733

3834
it("with correct order", async () => {
3935
const results = await runStylelint(expected);
40-
assert.ok(!results.errored);
4136
assert.equal(results.warnings.length, 0);
4237
});
4338
});

0 commit comments

Comments
 (0)