11import { describe , it , expect , vitest , beforeEach } from 'vitest' ;
22import formatProp from './formatProp' ;
33import formatPropValue from './formatPropValue' ;
4+ import { Options } from '../options' ;
45
56vitest . mock ( './formatPropValue' ) ;
67
78const defaultOptions = {
89 useBooleanShorthandSyntax : true ,
910 tabStop : 2 ,
10- } ;
11+ } as any as Options ;
1112
1213describe ( 'formatProp' , ( ) => {
1314 beforeEach ( ( ) => {
@@ -16,7 +17,7 @@ describe('formatProp', () => {
1617 } ) ;
1718
1819 it ( 'should format prop with only a value' , ( ) => {
19- formatPropValue . mockReturnValue ( '"MockedPropValue"' ) ;
20+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '"MockedPropValue"' ) ;
2021
2122 expect (
2223 formatProp ( 'foo' , true , 'bar' , false , null , true , 0 , defaultOptions )
@@ -36,7 +37,7 @@ describe('formatProp', () => {
3637 } ) ;
3738
3839 it ( 'should format prop with only a default value' , ( ) => {
39- formatPropValue . mockReturnValue ( '"MockedPropValue"' ) ;
40+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '"MockedPropValue"' ) ;
4041
4142 expect (
4243 formatProp ( 'foo' , false , null , true , 'baz' , true , 0 , defaultOptions )
@@ -56,7 +57,7 @@ describe('formatProp', () => {
5657 } ) ;
5758
5859 it ( 'should format prop with a value and a default value' , ( ) => {
59- formatPropValue . mockReturnValue ( '"MockedPropValue"' ) ;
60+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '"MockedPropValue"' ) ;
6061
6162 expect (
6263 formatProp ( 'foo' , true , 'bar' , true , 'baz' , true , 0 , defaultOptions )
@@ -79,9 +80,9 @@ describe('formatProp', () => {
7980 const options = {
8081 useBooleanShorthandSyntax : true ,
8182 tabStop : 2 ,
82- } ;
83+ } as Options ;
8384
84- formatPropValue . mockReturnValue ( '{true}' ) ;
85+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '{true}' ) ;
8586
8687 expect (
8788 formatProp ( 'foo' , true , true , false , false , true , 0 , options )
@@ -99,9 +100,9 @@ describe('formatProp', () => {
99100 const options = {
100101 useBooleanShorthandSyntax : true ,
101102 tabStop : 2 ,
102- } ;
103+ } as Options ;
103104
104- formatPropValue . mockReturnValue ( '{false}' ) ;
105+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '{false}' ) ;
105106
106107 expect (
107108 formatProp ( 'foo' , true , false , false , null , true , 0 , options )
@@ -118,9 +119,9 @@ describe('formatProp', () => {
118119 const options = {
119120 useBooleanShorthandSyntax : false ,
120121 tabStop : 2 ,
121- } ;
122+ } as Options ;
122123
123- formatPropValue . mockReturnValue ( '{true}' ) ;
124+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '{true}' ) ;
124125
125126 expect (
126127 formatProp ( 'foo' , true , true , false , false , true , 0 , options )
@@ -138,9 +139,9 @@ describe('formatProp', () => {
138139 const options = {
139140 useBooleanShorthandSyntax : false ,
140141 tabStop : 2 ,
141- } ;
142+ } as Options ;
142143
143- formatPropValue . mockReturnValue ( '{false}' ) ;
144+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '{false}' ) ;
144145
145146 expect (
146147 formatProp ( 'foo' , true , false , false , false , true , 0 , options )
@@ -155,7 +156,7 @@ describe('formatProp', () => {
155156 } ) ;
156157
157158 it ( 'should format a mulitline props' , ( ) => {
158- formatPropValue . mockReturnValue ( `{[
159+ vitest . mocked ( formatPropValue ) . mockReturnValue ( `{[
159160"a",
160161"b"
161162]}` ) ;
@@ -202,9 +203,9 @@ describe('formatProp', () => {
202203 const options = {
203204 useBooleanShorthandSyntax : true ,
204205 tabStop : 2 ,
205- } ;
206+ } as Options ;
206207
207- formatPropValue . mockReturnValue ( '"MockedPropValue"' ) ;
208+ vitest . mocked ( formatPropValue ) . mockReturnValue ( '"MockedPropValue"' ) ;
208209
209210 expect (
210211 formatProp ( 'foo' , true , 'bar' , false , null , true , 4 , options )
0 commit comments