@@ -68,13 +68,13 @@ describe('arrays', () => {
68
68
69
69
it ( 'duplicate maps should be removed from arrays' , ( ) => {
70
70
expect ( convertTokenToTypeScript ( tokenize ( [ { key : 'mads' } , { key : 'was' } , { key : 'here' } ] ) ) ) . toEqual (
71
- 'Array<{ key: string }>'
71
+ 'Array<{ " key" : string }>'
72
72
) ;
73
73
} ) ;
74
74
75
75
it ( 'maps should be able to be mixed in arrays' , ( ) => {
76
76
expect ( convertTokenToTypeScript ( tokenize ( [ { key : 1.23 } , { key : 'mads' } , { key : 1 } ] ) ) ) . toEqual (
77
- 'Array<{ key: number } | { key: string }>'
77
+ 'Array<{ " key" : number } | { " key" : string }>'
78
78
) ;
79
79
} ) ;
80
80
} ) ;
@@ -85,7 +85,7 @@ describe('maps', () => {
85
85
} ) ;
86
86
87
87
it ( 'maps should support primitive value children' , ( ) => {
88
- expect ( convertTokenToTypeScript ( tokenize ( { key : 'value' } ) ) ) . toEqual ( '{ key: string }' ) ;
88
+ expect ( convertTokenToTypeScript ( tokenize ( { key : 'value' } ) ) ) . toEqual ( '{ " key" : string }' ) ;
89
89
90
90
expect (
91
91
convertTokenToTypeScript (
@@ -97,7 +97,9 @@ describe('maps', () => {
97
97
falseKey : false ,
98
98
} )
99
99
)
100
- ) . toEqual ( '{ falseKey: boolean; nullKey: null; numberKey: number; stringKey: string; trueKey: boolean }' ) ;
100
+ ) . toEqual (
101
+ '{ "falseKey": boolean; "nullKey": null; "numberKey": number; "stringKey": string; "trueKey": boolean }'
102
+ ) ;
101
103
} ) ;
102
104
103
105
it ( 'maps should be able to be nested' , ( ) => {
@@ -115,11 +117,11 @@ describe('maps', () => {
115
117
} ,
116
118
} )
117
119
)
118
- ) . toEqual ( '{ a : { b : { c : { d : { key: string } } } } }' ) ;
120
+ ) . toEqual ( '{ "a" : { "b" : { "c" : { "d" : { " key" : string } } } } }' ) ;
119
121
} ) ;
120
122
121
123
it ( 'it should be possible to mix map with arrays' , ( ) => {
122
- expect ( convertTokenToTypeScript ( tokenize ( { arr : [ 1.23 ] } ) ) ) . toEqual ( '{ arr: Array<number> }' ) ;
124
+ expect ( convertTokenToTypeScript ( tokenize ( { arr : [ 1.23 ] } ) ) ) . toEqual ( '{ " arr" : Array<number> }' ) ;
123
125
} ) ;
124
126
125
127
it ( 'maps should be sorted automatically' , ( ) => {
@@ -182,7 +184,7 @@ describe('json2ts', async () => {
182
184
}` ;
183
185
184
186
const expectedResult =
185
- 'type GeneratedStruct = { printWidth: number; semi: boolean; singleQuote: boolean; tabWidth: number; useTabs: boolean }' ;
187
+ 'type GeneratedStruct = { " printWidth" : number; " semi" : boolean; " singleQuote" : boolean; " tabWidth" : number; " useTabs" : boolean }' ;
186
188
187
189
expect ( generateTypeScriptType ( tokenize ( JSON . parse ( jsonStr ) ) ) ) . toEqual ( expectedResult ) ;
188
190
} ) ;
@@ -200,7 +202,7 @@ describe('json2ts', async () => {
200
202
}` ;
201
203
202
204
const expectedResult =
203
- 'type GeneratedStruct = { data: Array<{ length: number; message: string; retry_after: number }> }' ;
205
+ 'type GeneratedStruct = { " data" : Array<{ " length" : number; " message" : string; " retry_after" : number }> }' ;
204
206
205
207
expect ( generateTypeScriptType ( tokenize ( JSON . parse ( jsonStr ) ) ) ) . toEqual ( expectedResult ) ;
206
208
} ) ;
0 commit comments