@@ -15,7 +15,7 @@ import {
15
15
} from "../../src/lib/ts.js" ;
16
16
17
17
describe ( "addJSDocComment" , ( ) => {
18
- it ( "single-line comment" , ( ) => {
18
+ test ( "single-line comment" , ( ) => {
19
19
const property = ts . factory . createPropertySignature (
20
20
undefined ,
21
21
"comment" ,
@@ -30,7 +30,7 @@ describe("addJSDocComment", () => {
30
30
}` ) ;
31
31
} ) ;
32
32
33
- it ( "multi-line comment" , ( ) => {
33
+ test ( "multi-line comment" , ( ) => {
34
34
const property = ts . factory . createPropertySignature (
35
35
undefined ,
36
36
"comment" ,
@@ -57,7 +57,7 @@ describe("addJSDocComment", () => {
57
57
}` ) ;
58
58
} ) ;
59
59
60
- it ( "escapes internal comments" , ( ) => {
60
+ test ( "escapes internal comments" , ( ) => {
61
61
const property = ts . factory . createPropertySignature (
62
62
undefined ,
63
63
"comment" ,
@@ -77,19 +77,19 @@ describe("addJSDocComment", () => {
77
77
} ) ;
78
78
79
79
describe ( "oapiRef" , ( ) => {
80
- it ( "single part" , ( ) => {
80
+ test ( "single part" , ( ) => {
81
81
expect ( astToString ( oapiRef ( "#/components" ) ) . trim ( ) ) . toBe ( `components` ) ;
82
82
} ) ;
83
83
84
- it ( "multiple parts" , ( ) => {
84
+ test ( "multiple parts" , ( ) => {
85
85
expect ( astToString ( oapiRef ( "#/components/schemas/User" ) ) . trim ( ) ) . toBe (
86
86
`components["schemas"]["User"]` ,
87
87
) ;
88
88
} ) ;
89
89
} ) ;
90
90
91
91
describe ( "tsEnum" , ( ) => {
92
- it ( "string members" , ( ) => {
92
+ test ( "string members" , ( ) => {
93
93
expect ( astToString ( tsEnum ( "-my-color-" , [ "green" , "red" , "blue" ] ) ) . trim ( ) )
94
94
. toBe ( `enum MyColor {
95
95
green = "green",
@@ -98,7 +98,7 @@ describe("tsEnum", () => {
98
98
}` ) ;
99
99
} ) ;
100
100
101
- it ( "name from path" , ( ) => {
101
+ test ( "name from path" , ( ) => {
102
102
expect (
103
103
astToString (
104
104
tsEnum ( "#/paths/url/get/parameters/query/status" , [
@@ -112,7 +112,7 @@ describe("tsEnum", () => {
112
112
}` ) ;
113
113
} ) ;
114
114
115
- it ( "string members with numeric prefix" , ( ) => {
115
+ test ( "string members with numeric prefix" , ( ) => {
116
116
expect ( astToString ( tsEnum ( "/my/enum/" , [ "0a" , "1b" , "2c" ] ) ) . trim ( ) )
117
117
. toBe ( `enum MyEnum {
118
118
Value0a = "0a",
@@ -121,7 +121,7 @@ describe("tsEnum", () => {
121
121
}` ) ;
122
122
} ) ;
123
123
124
- it ( "number members" , ( ) => {
124
+ test ( "number members" , ( ) => {
125
125
expect ( astToString ( tsEnum ( ".Error.code." , [ 100 , 101 , 102 ] ) ) . trim ( ) )
126
126
. toBe ( `enum ErrorCode {
127
127
Value100 = 100,
@@ -130,7 +130,7 @@ describe("tsEnum", () => {
130
130
}` ) ;
131
131
} ) ;
132
132
133
- it ( "number members with x-enum-descriptions" , ( ) => {
133
+ test ( "number members with x-enum-descriptions" , ( ) => {
134
134
expect (
135
135
astToString (
136
136
tsEnum (
@@ -153,7 +153,7 @@ describe("tsEnum", () => {
153
153
}` ) ;
154
154
} ) ;
155
155
156
- it ( "x-enum-varnames" , ( ) => {
156
+ test ( "x-enum-varnames" , ( ) => {
157
157
expect (
158
158
astToString (
159
159
tsEnum (
@@ -173,7 +173,7 @@ describe("tsEnum", () => {
173
173
}` ) ;
174
174
} ) ;
175
175
176
- it ( "x-enum-varnames with numeric prefix" , ( ) => {
176
+ test ( "x-enum-varnames with numeric prefix" , ( ) => {
177
177
expect (
178
178
astToString (
179
179
tsEnum (
@@ -189,7 +189,7 @@ describe("tsEnum", () => {
189
189
}` ) ;
190
190
} ) ;
191
191
192
- it ( "partial x-enum-varnames and x-enum-descriptions" , ( ) => {
192
+ test ( "partial x-enum-varnames and x-enum-descriptions" , ( ) => {
193
193
expect (
194
194
astToString (
195
195
tsEnum (
@@ -209,7 +209,7 @@ describe("tsEnum", () => {
209
209
}` ) ;
210
210
} ) ;
211
211
212
- it ( "x-enum-descriptions with x-enum-varnames" , ( ) => {
212
+ test ( "x-enum-descriptions with x-enum-varnames" , ( ) => {
213
213
expect (
214
214
astToString (
215
215
tsEnum (
@@ -237,15 +237,15 @@ describe("tsEnum", () => {
237
237
} ) ;
238
238
239
239
describe ( "tsPropertyIndex" , ( ) => {
240
- it ( "numbers -> number literals" , ( ) => {
240
+ test ( "numbers -> number literals" , ( ) => {
241
241
expect ( astToString ( tsPropertyIndex ( 200 ) ) . trim ( ) ) . toBe ( `200` ) ;
242
242
expect ( astToString ( tsPropertyIndex ( 200.5 ) ) . trim ( ) ) . toBe ( `200.5` ) ;
243
243
expect ( astToString ( tsPropertyIndex ( Infinity ) ) . trim ( ) ) . toBe ( `Infinity` ) ;
244
244
expect ( astToString ( tsPropertyIndex ( NaN ) ) . trim ( ) ) . toBe ( `NaN` ) ;
245
245
expect ( astToString ( tsPropertyIndex ( 10e3 ) ) . trim ( ) ) . toBe ( `10000` ) ;
246
246
} ) ;
247
247
248
- it ( "valid strings -> identifiers" , ( ) => {
248
+ test ( "valid strings -> identifiers" , ( ) => {
249
249
expect ( astToString ( tsPropertyIndex ( "identifier" ) ) . trim ( ) ) . toBe (
250
250
`identifier` ,
251
251
) ;
@@ -257,7 +257,7 @@ describe("tsPropertyIndex", () => {
257
257
expect ( astToString ( tsPropertyIndex ( "10e3" ) ) . trim ( ) ) . toBe ( `"10e3"` ) ;
258
258
} ) ;
259
259
260
- it ( "invalid strings -> string literals" , ( ) => {
260
+ test ( "invalid strings -> string literals" , ( ) => {
261
261
expect ( astToString ( tsPropertyIndex ( "kebab-case" ) ) . trim ( ) ) . toBe (
262
262
`"kebab-case"` ,
263
263
) ;
@@ -273,27 +273,27 @@ describe("tsPropertyIndex", () => {
273
273
} ) ;
274
274
275
275
describe ( "tsIsPrimitive" , ( ) => {
276
- it ( "null" , ( ) => {
276
+ test ( "null" , ( ) => {
277
277
expect ( tsIsPrimitive ( NULL ) ) . toBe ( true ) ;
278
278
} ) ;
279
279
280
- it ( "number" , ( ) => {
280
+ test ( "number" , ( ) => {
281
281
expect ( tsIsPrimitive ( NUMBER ) ) . toBe ( true ) ;
282
282
} ) ;
283
283
284
- it ( "string" , ( ) => {
284
+ test ( "string" , ( ) => {
285
285
expect ( tsIsPrimitive ( STRING ) ) . toBe ( true ) ;
286
286
} ) ;
287
287
288
- it ( "boolean" , ( ) => {
288
+ test ( "boolean" , ( ) => {
289
289
expect ( tsIsPrimitive ( BOOLEAN ) ) . toBe ( true ) ;
290
290
} ) ;
291
291
292
- it ( "array" , ( ) => {
292
+ test ( "array" , ( ) => {
293
293
expect ( tsIsPrimitive ( ts . factory . createArrayTypeNode ( STRING ) ) ) . toBe ( false ) ;
294
294
} ) ;
295
295
296
- it ( "object" , ( ) => {
296
+ test ( "object" , ( ) => {
297
297
expect (
298
298
tsIsPrimitive (
299
299
ts . factory . createTypeLiteralNode ( [
@@ -310,29 +310,29 @@ describe("tsIsPrimitive", () => {
310
310
} ) ;
311
311
312
312
describe ( "tsUnion" , ( ) => {
313
- it ( "none" , ( ) => {
313
+ test ( "none" , ( ) => {
314
314
expect ( astToString ( tsUnion ( [ ] ) ) . trim ( ) ) . toBe ( `never` ) ;
315
315
} ) ;
316
316
317
- it ( "one" , ( ) => {
317
+ test ( "one" , ( ) => {
318
318
expect ( astToString ( tsUnion ( [ STRING ] ) ) . trim ( ) ) . toBe ( `string` ) ;
319
319
} ) ;
320
320
321
- it ( "multiple (primitive)" , ( ) => {
321
+ test ( "multiple (primitive)" , ( ) => {
322
322
expect (
323
323
astToString ( tsUnion ( [ STRING , STRING , NUMBER , NULL , NUMBER , NULL ] ) ) . trim ( ) ,
324
324
) . toBe ( `string | number | null` ) ;
325
325
} ) ;
326
326
327
- it ( "multiple (const)" , ( ) => {
327
+ test ( "multiple (const)" , ( ) => {
328
328
expect (
329
329
astToString (
330
330
tsUnion ( [ NULL , tsLiteral ( "red" ) , tsLiteral ( 42 ) , tsLiteral ( false ) ] ) ,
331
331
) . trim ( ) ,
332
332
) . toBe ( `null | "red" | 42 | false` ) ;
333
333
} ) ;
334
334
335
- it ( "multiple (object types)" , ( ) => {
335
+ test ( "multiple (object types)" , ( ) => {
336
336
const obj = ts . factory . createTypeLiteralNode ( [
337
337
ts . factory . createPropertySignature ( undefined , "foo" , undefined , STRING ) ,
338
338
] ) ;
0 commit comments