1- import { test , expect } from 'vitest' ;
2- import { analyze } from './analyze-custom-properties' ;
1+ import { test , expect } from 'vitest'
2+ import { analyze } from './analyze-custom-properties'
33
44test ( 'unused property' , ( ) => {
55 let actual = analyze ( `
@@ -22,9 +22,7 @@ test('undeclared property', () => {
2222 expect ( actual . undeclared_with_fallback . size ) . toBe ( 0 )
2323 expect ( actual . unused . size ) . toBe ( 0 )
2424 expect ( actual . all . size ) . toBe ( 1 )
25- expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [
26- { column : 3 , length : 25 , line : 3 , offset : 8 }
27- ] )
25+ expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [ { column : 10 , length : 17 , line : 3 , offset : 15 } ] )
2826} )
2927
3028test ( 'undeclared property with fallback' , ( ) => {
@@ -36,9 +34,7 @@ test('undeclared property with fallback', () => {
3634 expect ( actual . undeclared . size ) . toBe ( 0 )
3735 expect ( actual . unused . size ) . toBe ( 0 )
3836 expect ( actual . all . size ) . toBe ( 1 )
39- expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [
40- { column : 3 , length : 30 , line : 3 , offset : 8 }
41- ] )
37+ expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [ { column : 10 , length : 22 , line : 3 , offset : 15 } ] )
4238} )
4339
4440test ( 'undeclared property with undefined custom property as fallback' , ( ) => {
@@ -50,9 +46,8 @@ test('undeclared property with undefined custom property as fallback', () => {
5046 expect ( actual . undeclared . size ) . toBe ( 1 )
5147 expect ( actual . unused . size ) . toBe ( 0 )
5248 expect ( actual . all . size ) . toBe ( 2 )
53- expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [
54- { column : 3 , length : 46 , line : 3 , offset : 8 }
55- ] )
49+ expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [ { column : 10 , length : 38 , line : 3 , offset : 15 } ] )
50+ expect ( actual . all . get ( '--undeclared-2' ) ) . toEqual ( [ { column : 28 , length : 19 , line : 3 , offset : 33 } ] )
5651} )
5752
5853test ( 'undeclared property with defined custom property as fallback' , ( ) => {
@@ -65,9 +60,7 @@ test('undeclared property with defined custom property as fallback', () => {
6560 expect ( actual . undeclared . size ) . toBe ( 0 )
6661 expect ( actual . unused . size ) . toBe ( 0 )
6762 expect ( actual . all . size ) . toBe ( 2 )
68- expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [
69- { column : 3 , length : 42 , line : 4 , offset : 25 }
70- ] )
63+ expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [ { column : 10 , length : 34 , line : 4 , offset : 32 } ] )
7164} )
7265
7366test ( 'undeclared property with empty fallback' , ( ) => {
@@ -79,9 +72,7 @@ test('undeclared property with empty fallback', () => {
7972 expect ( actual . undeclared . size ) . toBe ( 0 )
8073 expect ( actual . unused . size ) . toBe ( 0 )
8174 expect ( actual . all . size ) . toBe ( 1 )
82- expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [
83- { column : 3 , length : 27 , line : 3 , offset : 8 }
84- ] )
75+ expect ( actual . all . get ( '--undeclared' ) ) . toEqual ( [ { column : 10 , length : 19 , line : 3 , offset : 15 } ] )
8576} )
8677
8778test ( 'unused @property' , ( ) => {
@@ -94,9 +85,7 @@ test('unused @property', () => {
9485 expect ( actual . undeclared . size ) . toBe ( 0 )
9586 expect ( actual . undeclared_with_fallback . size ) . toBe ( 0 )
9687 expect ( actual . all . size ) . toBe ( 1 )
97- expect ( actual . all . get ( '--unused' ) ) . toEqual ( [
98- { column : 2 , length : 66 , line : 2 , offset : 2 }
99- ] )
88+ expect ( actual . all . get ( '--unused' ) ) . toEqual ( [ { column : 2 , length : 66 , line : 2 , offset : 2 } ] )
10089} )
10190
10291test ( 'used @property' , ( ) => {
@@ -114,6 +103,6 @@ test('used @property', () => {
114103 expect ( actual . all . size ) . toBe ( 1 )
115104 expect ( actual . all . get ( '--used' ) ) . toEqual ( [
116105 { column : 2 , length : 64 , line : 2 , offset : 2 } ,
117- { column : 3 , length : 15 , line : 7 , offset : 74 }
106+ { column : 6 , length : 11 , line : 7 , offset : 77 }
118107 ] )
119- } )
108+ } )
0 commit comments