@@ -29,7 +29,7 @@ test('It calculates the diff for two different stats correctly', t => {
2929 [ 'unchangedValue' , 'removedValue' ] ,
3030 [ 'addedValue' , 'unchangedValue' ]
3131 )
32- const expectedDiff = [
32+ const expected = [
3333 {
3434 value : 'addedValue' ,
3535 removed : false ,
@@ -52,12 +52,12 @@ test('It calculates the diff for two different stats correctly', t => {
5252
5353 t . true ( result . changed )
5454 t . is ( 3 , result . diff . length )
55- t . deepEqual ( result . diff , expectedDiff )
55+ t . deepEqual ( result . diff , expected )
5656} )
5757
5858test ( 'It calculates the diff correctly for two exact same stats' , t => {
5959 const result = diff ( [ 'item1' , 'item2' ] , [ 'item1' , 'item2' ] )
60- const expectedDiff = [
60+ const expected = [
6161 {
6262 value : 'item1' ,
6363 removed : false ,
@@ -74,12 +74,12 @@ test('It calculates the diff correctly for two exact same stats', t => {
7474
7575 t . false ( result . changed )
7676 t . is ( 2 , result . diff . length )
77- t . deepEqual ( result . diff , expectedDiff )
77+ t . deepEqual ( result . diff , expected )
7878} )
7979
8080test ( 'It handles the first listable stat being absent in one of the stats' , t => {
8181 const actual = diff ( undefined , [ 'cat' , 'dog' ] )
82- const expectedDiff = {
82+ const expected = {
8383 changed : true ,
8484 diff : [
8585 {
@@ -97,12 +97,12 @@ test('It handles the first listable stat being absent in one of the stats', t =>
9797 ]
9898 }
9999
100- t . deepEqual ( actual , expectedDiff )
100+ t . deepEqual ( actual , expected )
101101} )
102102
103103test ( 'It handles the second listable stat being absent in one of the stats' , t => {
104104 const actual = diff ( [ 'cat' , 'dog' ] , undefined )
105- const expectedDiff = {
105+ const expected = {
106106 changed : true ,
107107 diff : [
108108 {
@@ -120,15 +120,15 @@ test('It handles the second listable stat being absent in one of the stats', t =
120120 ]
121121 }
122122
123- t . deepEqual ( actual , expectedDiff )
123+ t . deepEqual ( actual , expected )
124124} )
125125
126126test ( 'It sorts selectors/values/properties correctly' , t => {
127127 const actual = diff (
128128 [ 'a:after' , 'a:before' ] ,
129129 [ 'a:after' , 'aa:before' , 'b:before' ]
130130 )
131- const expectedDiff = {
131+ const expected = {
132132 changed : true ,
133133 diff : [
134134 {
@@ -158,7 +158,7 @@ test('It sorts selectors/values/properties correctly', t => {
158158 ]
159159 }
160160
161- t . deepEqual ( actual , expectedDiff )
161+ t . deepEqual ( actual , expected )
162162} )
163163
164164test ( 'It sorts fontsizes correctly after comparing them' , t => {
@@ -167,7 +167,7 @@ test('It sorts fontsizes correctly after comparing them', t => {
167167 [ '0' , '.5em' , '1em' , '3rem' ] ,
168168 'values.fontsizes.unique'
169169 )
170- const expectedDiff = {
170+ const expected = {
171171 changed : true ,
172172 diff : [
173173 {
@@ -209,7 +209,7 @@ test('It sorts fontsizes correctly after comparing them', t => {
209209 ]
210210 }
211211
212- t . deepEqual ( actual , expectedDiff )
212+ t . deepEqual ( actual , expected )
213213} )
214214
215215test ( 'It sorts colors correctly after comparing them' , t => {
@@ -218,7 +218,7 @@ test('It sorts colors correctly after comparing them', t => {
218218 [ 'red' , 'yellow' , 'green' , 'blue' , 'purple' ] ,
219219 'values.colors.unique'
220220 )
221- const expectedDiff = {
221+ const expected = {
222222 changed : true ,
223223 diff : [
224224 {
@@ -260,5 +260,50 @@ test('It sorts colors correctly after comparing them', t => {
260260 ]
261261 }
262262
263- t . deepEqual ( actual , expectedDiff )
263+ t . deepEqual ( actual , expected )
264+ } )
265+
266+ test ( 'it sorts zindexes correctly after comparing them' , t => {
267+ const actual = diff (
268+ [ - 100 , - 1 , 0 , 1 , 999 ] ,
269+ [ - 100 , 0 , 1 , 999 ] ,
270+ 'values.zindexes.unique'
271+ )
272+ const expected = {
273+ changed : true ,
274+ diff : [
275+ {
276+ value : - 100 ,
277+ changed : false ,
278+ added : false ,
279+ removed : false
280+ } ,
281+ {
282+ value : - 1 ,
283+ changed : true ,
284+ added : false ,
285+ removed : true
286+ } ,
287+ {
288+ value : 0 ,
289+ changed : false ,
290+ added : false ,
291+ removed : false
292+ } ,
293+ {
294+ value : 1 ,
295+ changed : false ,
296+ added : false ,
297+ removed : false
298+ } ,
299+ {
300+ value : 999 ,
301+ changed : false ,
302+ added : false ,
303+ removed : false
304+ }
305+ ]
306+ }
307+
308+ t . deepEqual ( actual , expected )
264309} )
0 commit comments