1- import { assert } from 'chai' ;
1+ import { expect } from 'chai' ;
22import createSpacing from './createSpacing' ;
33import consoleErrorMock from 'test/utils/consoleErrorMock' ;
44
55describe ( 'createSpacing' , ( ) => {
66 it ( 'should work as expected' , ( ) => {
77 let spacing ;
88 spacing = createSpacing ( ) ;
9- assert . strictEqual ( spacing ( 1 ) , 8 ) ;
9+ expect ( spacing ( 1 ) ) . to . equal ( 8 ) ;
1010 spacing = createSpacing ( 10 ) ;
11- assert . strictEqual ( spacing ( 1 ) , 10 ) ;
12- spacing = createSpacing ( factor => [ 0 , 8 , 16 ] [ factor ] ) ;
13- assert . strictEqual ( spacing ( 2 ) , 16 ) ;
11+ expect ( spacing ( 1 ) ) . to . equal ( 10 ) ;
12+ spacing = createSpacing ( [ 0 , 8 , 16 ] ) ;
13+ expect ( spacing ( 2 ) ) . to . equal ( 16 ) ;
1414 spacing = createSpacing ( factor => factor ** 2 ) ;
15- assert . strictEqual ( spacing ( 2 ) , 4 ) ;
15+ expect ( spacing ( 2 ) ) . to . equal ( 4 ) ;
1616 spacing = createSpacing ( factor => `${ 0.25 * factor } rem` ) ;
17- assert . strictEqual ( spacing ( 2 ) , '0.5rem' ) ;
17+ expect ( spacing ( 2 ) ) . to . equal ( '0.5rem' ) ;
1818 } ) ;
1919
2020 it ( 'should support recursion' , ( ) => {
@@ -25,17 +25,17 @@ describe('createSpacing', () => {
2525 it ( 'should support a default value when no arguments are provided' , ( ) => {
2626 let spacing ;
2727 spacing = createSpacing ( ) ;
28- assert . strictEqual ( spacing ( ) , 8 ) ;
28+ expect ( spacing ( ) ) . to . equal ( 8 ) ;
2929 spacing = createSpacing ( factor => `${ 0.25 * factor } rem` ) ;
30- assert . strictEqual ( spacing ( ) , '0.25rem' ) ;
30+ expect ( spacing ( ) ) . to . equal ( '0.25rem' ) ;
3131 } ) ;
3232
3333 it ( 'should support multiple arguments' , ( ) => {
3434 let spacing ;
3535 spacing = createSpacing ( ) ;
36- assert . strictEqual ( spacing ( 1 , 2 ) , '8px 16px' ) ;
36+ expect ( spacing ( 1 , 2 ) ) . to . equal ( '8px 16px' ) ;
3737 spacing = createSpacing ( factor => `${ 0.25 * factor } rem` ) ;
38- assert . strictEqual ( spacing ( 1 , 2 ) , '0.25rem 0.5rem' ) ;
38+ expect ( spacing ( 1 , 2 ) ) . to . equal ( '0.25rem 0.5rem' ) ;
3939 } ) ;
4040
4141 describe ( 'warnings' , ( ) => {
@@ -47,20 +47,22 @@ describe('createSpacing', () => {
4747 consoleErrorMock . reset ( ) ;
4848 } ) ;
4949
50+ // TODO v5: remove
5051 it ( 'should warn for the deprecated API' , ( ) => {
5152 const spacing = createSpacing ( 11 ) ;
52- assert . strictEqual ( spacing . unit , 11 ) ;
53- assert . strictEqual ( consoleErrorMock . callCount ( ) , 1 ) ;
54- assert . include ( consoleErrorMock . args ( ) [ 0 ] [ 0 ] , 'theme.spacing.unit usage has been deprecated' ) ;
53+ expect ( spacing . unit ) . to . equal ( 11 ) ;
54+ expect ( consoleErrorMock . callCount ( ) ) . to . equal ( 1 ) ;
55+ expect ( consoleErrorMock . args ( ) [ 0 ] [ 0 ] ) . to . include (
56+ 'theme.spacing.unit usage has been deprecated' ,
57+ ) ;
5558 } ) ;
5659
5760 it ( 'should warn for wrong input' , ( ) => {
5861 createSpacing ( {
5962 unit : 4 ,
6063 } ) ;
61- assert . strictEqual ( consoleErrorMock . callCount ( ) , 1 ) ;
62- assert . include (
63- consoleErrorMock . args ( ) [ 0 ] [ 0 ] ,
64+ expect ( consoleErrorMock . callCount ( ) ) . to . equal ( 1 ) ;
65+ expect ( consoleErrorMock . args ( ) [ 0 ] [ 0 ] ) . to . include (
6466 'the `theme.spacing` value ([object Object]) is invalid' ,
6567 ) ;
6668 } ) ;
0 commit comments