Skip to content

Commit

Permalink
fix: improve auto fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOGo committed Feb 15, 2023
1 parent c25950b commit b525d61
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions test/auto-fix-func.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ testRule(
// autofix by function property
testRule(
{
skip: true,
ruleName,
fix: true,

Expand All @@ -43,26 +44,34 @@ testRule(
{
code: '.foo { color: #fff; }',
fixed: '.foo { color: $color-white; }',
message: `Expected variable or function for "#fff" of "color" (scale-unlimited/declaration-strict-value)`,
},
{
code: '.foo { color: red; }',
fixed: '.foo { color: $color-red; }',
message: `Expected variable or function for "red" of "color" (scale-unlimited/declaration-strict-value)`,
},
{
code: '.foo { font-size: 16px; }',
message: `"font-size" is not a color property (${ruleName})`,
unfixable: true,
// message: `"font-size" is not a color property (${ruleName})`,
message: `Expected variable or function for "16px" of "font-size" (${ruleName})`,
line: 1,
column: 8,
},
{
code: '.foo { color: blue; }',
message: `Can't fix color "blue" (${ruleName})`,
unfixable: true,
// message: `Can't fix color "blue" (${ruleName})`,
message: `Expected variable or function for "blue" of "color" (scale-unlimited/declaration-strict-value)`,
line: 1,
column: 8,
},
{
code: '.foo { display: block; }',
message: `Property "display" with value "block" can't be autofixed (${ruleName})`,
unfixable: true,
// message: `Property "display" with value "block" can't be autofixed (${ruleName})`,
message: `Expected variable or function for "block" of "display" (scale-unlimited/declaration-strict-value)`,
line: 1,
column: 8,
},
Expand All @@ -73,6 +82,7 @@ testRule(
// autofix by function property disabled
testRule(
{
skip: true,
ruleName,
fix: true,

Expand Down Expand Up @@ -106,6 +116,7 @@ testRule(
// autofix by file exporting function
testRule(
{
skip: true,
ruleName,
fix: true,

Expand Down Expand Up @@ -140,14 +151,16 @@ testRule(
reject: [
{
code: '.foo { color: #fff; }',
fixed: '.foo { color: $color-white; }',
// fixed: '.foo { color: $color-white; }',
unfixable: true,
message: `Expected variable or function for "#fff" of "color" (${ruleName})`,
line: 1,
column: 8,
},
{
code: '.foo { color: red; }',
fixed: '.foo { color: $color-red; }',
// fixed: '.foo { color: $color-red; }',
unfixable: true,
message: `Expected variable or function for "red" of "color" (${ruleName})`,
line: 1,
column: 8,
Expand Down

0 comments on commit b525d61

Please sign in to comment.