@scalar/mock-server 0.3.23 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/createMockServer.d.ts +1 -1
- package/dist/createMockServer.d.ts.map +1 -1
- package/dist/createMockServer.js +36 -48
- package/dist/createMockServer.js.map +7 -0
- package/dist/createMockServer.test.js +598 -0
- package/dist/createMockServer.test.js.map +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +7 -0
- package/dist/routes/mockAnyResponse.d.ts +1 -1
- package/dist/routes/mockAnyResponse.d.ts.map +1 -1
- package/dist/routes/mockAnyResponse.js +56 -64
- package/dist/routes/mockAnyResponse.js.map +7 -0
- package/dist/routes/respondWithAuthorizePage.js +39 -31
- package/dist/routes/respondWithAuthorizePage.js.map +7 -0
- package/dist/routes/respondWithOpenApiDocument.js +35 -35
- package/dist/routes/respondWithOpenApiDocument.js.map +7 -0
- package/dist/routes/respondWithToken.js +44 -41
- package/dist/routes/respondWithToken.js.map +7 -0
- package/dist/types.js +5 -4
- package/dist/types.js.map +7 -0
- package/dist/utils/createOpenApiDefinition.js +11 -0
- package/dist/utils/createOpenApiDefinition.js.map +7 -0
- package/dist/utils/findPreferredResponseKey.js +8 -10
- package/dist/utils/findPreferredResponseKey.js.map +7 -0
- package/dist/utils/findPreferredResponseKey.test.js +20 -0
- package/dist/utils/findPreferredResponseKey.test.js.map +7 -0
- package/dist/utils/getOpenAuthTokenUrls.js +33 -45
- package/dist/utils/getOpenAuthTokenUrls.js.map +7 -0
- package/dist/utils/getOpenAuthTokenUrls.test.js +127 -0
- package/dist/utils/getOpenAuthTokenUrls.test.js.map +7 -0
- package/dist/utils/getOperations.d.ts +1 -1
- package/dist/utils/getOperations.d.ts.map +1 -1
- package/dist/utils/getOperations.js +11 -14
- package/dist/utils/getOperations.js.map +7 -0
- package/dist/utils/handleAuthentication.js +95 -101
- package/dist/utils/handleAuthentication.js.map +7 -0
- package/dist/utils/honoRouteFromPath.js +5 -7
- package/dist/utils/honoRouteFromPath.js.map +7 -0
- package/dist/utils/honoRouteFromPath.test.js +32 -0
- package/dist/utils/honoRouteFromPath.test.js.map +7 -0
- package/dist/utils/isAuthenticationRequired.js +14 -18
- package/dist/utils/isAuthenticationRequired.js.map +7 -0
- package/dist/utils/isAuthenticationRequired.test.js +23 -0
- package/dist/utils/isAuthenticationRequired.test.js.map +7 -0
- package/dist/utils/logAuthenticationInstructions.js +109 -107
- package/dist/utils/logAuthenticationInstructions.js.map +7 -0
- package/dist/utils/setupAuthenticationRoutes.js +76 -82
- package/dist/utils/setupAuthenticationRoutes.js.map +7 -0
- package/package.json +7 -9
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createMockServer } from "./createMockServer.js";
|
|
3
|
+
describe("createMockServer", () => {
|
|
4
|
+
it("GET /foobar -> example JSON", async () => {
|
|
5
|
+
const specification = {
|
|
6
|
+
openapi: "3.1.0",
|
|
7
|
+
info: {
|
|
8
|
+
title: "Hello World",
|
|
9
|
+
version: "1.0.0"
|
|
10
|
+
},
|
|
11
|
+
paths: {
|
|
12
|
+
"/foobar": {
|
|
13
|
+
get: {
|
|
14
|
+
responses: {
|
|
15
|
+
"200": {
|
|
16
|
+
description: "OK",
|
|
17
|
+
content: {
|
|
18
|
+
"application/json": {
|
|
19
|
+
example: {
|
|
20
|
+
foo: "bar"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const server = await createMockServer({
|
|
31
|
+
specification
|
|
32
|
+
});
|
|
33
|
+
const response = await server.request("/foobar");
|
|
34
|
+
expect(response.status).toBe(200);
|
|
35
|
+
expect(await response.json()).toMatchObject({
|
|
36
|
+
foo: "bar"
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it("GET /foobar -> omits writeOnly properties in responses", async () => {
|
|
40
|
+
const specification = {
|
|
41
|
+
openapi: "3.1.0",
|
|
42
|
+
info: {
|
|
43
|
+
title: "Hello World",
|
|
44
|
+
version: "1.0.0"
|
|
45
|
+
},
|
|
46
|
+
paths: {
|
|
47
|
+
"/foobar": {
|
|
48
|
+
get: {
|
|
49
|
+
responses: {
|
|
50
|
+
"200": {
|
|
51
|
+
description: "OK",
|
|
52
|
+
content: {
|
|
53
|
+
"application/json": {
|
|
54
|
+
schema: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
id: {
|
|
58
|
+
type: "integer",
|
|
59
|
+
format: "int64",
|
|
60
|
+
readOnly: true,
|
|
61
|
+
example: 1
|
|
62
|
+
},
|
|
63
|
+
visible: {
|
|
64
|
+
type: "boolean",
|
|
65
|
+
example: true
|
|
66
|
+
},
|
|
67
|
+
password: {
|
|
68
|
+
type: "string",
|
|
69
|
+
writeOnly: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const server = await createMockServer({
|
|
82
|
+
specification
|
|
83
|
+
});
|
|
84
|
+
const response = await server.request("/foobar");
|
|
85
|
+
expect(response.status).toBe(200);
|
|
86
|
+
const data = await response.json();
|
|
87
|
+
expect(data).not.toHaveProperty("password");
|
|
88
|
+
expect(data).toStrictEqual({
|
|
89
|
+
id: 1,
|
|
90
|
+
visible: true
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
it("GET /foobar -> return HTML if accepted", async () => {
|
|
94
|
+
const specification = {
|
|
95
|
+
openapi: "3.1.0",
|
|
96
|
+
info: {
|
|
97
|
+
title: "Hello World",
|
|
98
|
+
version: "1.0.0"
|
|
99
|
+
},
|
|
100
|
+
paths: {
|
|
101
|
+
"/foobar": {
|
|
102
|
+
get: {
|
|
103
|
+
responses: {
|
|
104
|
+
"200": {
|
|
105
|
+
description: "OK",
|
|
106
|
+
content: {
|
|
107
|
+
"application/json": {
|
|
108
|
+
example: {
|
|
109
|
+
foo: "bar"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"text/html": {
|
|
113
|
+
example: "foobar"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const server = await createMockServer({
|
|
123
|
+
specification
|
|
124
|
+
});
|
|
125
|
+
const response = await server.request("/foobar", {
|
|
126
|
+
headers: {
|
|
127
|
+
Accept: "text/html"
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
expect(response.status).toBe(200);
|
|
131
|
+
expect(await response.text()).toBe("foobar");
|
|
132
|
+
});
|
|
133
|
+
it("GET /foobar -> fall back to JSON", async () => {
|
|
134
|
+
const specification = {
|
|
135
|
+
openapi: "3.1.0",
|
|
136
|
+
info: {
|
|
137
|
+
title: "Hello World",
|
|
138
|
+
version: "1.0.0"
|
|
139
|
+
},
|
|
140
|
+
paths: {
|
|
141
|
+
"/foobar": {
|
|
142
|
+
get: {
|
|
143
|
+
responses: {
|
|
144
|
+
"200": {
|
|
145
|
+
description: "OK",
|
|
146
|
+
content: {
|
|
147
|
+
"application/json": {
|
|
148
|
+
example: {
|
|
149
|
+
foo: "bar"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"text/html": {
|
|
153
|
+
example: "foobar"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const server = await createMockServer({
|
|
163
|
+
specification
|
|
164
|
+
});
|
|
165
|
+
const response = await server.request("/foobar");
|
|
166
|
+
expect(response.status).toBe(200);
|
|
167
|
+
expect(await response.json()).toMatchObject({
|
|
168
|
+
foo: "bar"
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
it("GET /foobar -> XML", async () => {
|
|
172
|
+
const specification = {
|
|
173
|
+
openapi: "3.1.0",
|
|
174
|
+
info: {
|
|
175
|
+
title: "Hello World",
|
|
176
|
+
version: "1.0.0"
|
|
177
|
+
},
|
|
178
|
+
paths: {
|
|
179
|
+
"/foobar": {
|
|
180
|
+
get: {
|
|
181
|
+
responses: {
|
|
182
|
+
"200": {
|
|
183
|
+
description: "OK",
|
|
184
|
+
content: {
|
|
185
|
+
"application/xml": {
|
|
186
|
+
example: {
|
|
187
|
+
foo: "bar"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const server = await createMockServer({
|
|
198
|
+
specification
|
|
199
|
+
});
|
|
200
|
+
const response = await server.request("/foobar");
|
|
201
|
+
expect(response.status).toBe(200);
|
|
202
|
+
expect(await response.text()).toContain("<foo>bar</foo>");
|
|
203
|
+
});
|
|
204
|
+
it("uses http verbs only to register routes", async () => {
|
|
205
|
+
const specification = {
|
|
206
|
+
openapi: "3.1.0",
|
|
207
|
+
info: {
|
|
208
|
+
title: "Hello World",
|
|
209
|
+
version: "1.0.0"
|
|
210
|
+
},
|
|
211
|
+
paths: {
|
|
212
|
+
"/foobar": {
|
|
213
|
+
summary: "",
|
|
214
|
+
description: "",
|
|
215
|
+
parameters: {},
|
|
216
|
+
servers: {},
|
|
217
|
+
get: {
|
|
218
|
+
responses: {
|
|
219
|
+
"200": {
|
|
220
|
+
description: "OK",
|
|
221
|
+
content: {
|
|
222
|
+
"application/json": {
|
|
223
|
+
example: {
|
|
224
|
+
foo: "bar"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const server = await createMockServer({
|
|
235
|
+
specification
|
|
236
|
+
});
|
|
237
|
+
const response = await server.request("/foobar");
|
|
238
|
+
expect(response.status).toBe(200);
|
|
239
|
+
expect(await response.json()).toMatchObject({
|
|
240
|
+
foo: "bar"
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
it("POST /foobar -> example JSON", async () => {
|
|
244
|
+
const specification = {
|
|
245
|
+
openapi: "3.1.0",
|
|
246
|
+
info: {
|
|
247
|
+
title: "Hello World",
|
|
248
|
+
version: "1.0.0"
|
|
249
|
+
},
|
|
250
|
+
paths: {
|
|
251
|
+
"/foobar": {
|
|
252
|
+
post: {
|
|
253
|
+
responses: {
|
|
254
|
+
"200": {
|
|
255
|
+
description: "OK",
|
|
256
|
+
content: {
|
|
257
|
+
"application/json": {
|
|
258
|
+
example: {
|
|
259
|
+
foo: "bar"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const server = await createMockServer({
|
|
270
|
+
specification
|
|
271
|
+
});
|
|
272
|
+
const response = await server.request("/foobar", {
|
|
273
|
+
method: "POST"
|
|
274
|
+
});
|
|
275
|
+
expect(response.status).toBe(200);
|
|
276
|
+
expect(await response.json()).toMatchObject({
|
|
277
|
+
foo: "bar"
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
it("POST /foobar -> return 201", async () => {
|
|
281
|
+
const specification = {
|
|
282
|
+
openapi: "3.1.0",
|
|
283
|
+
info: {
|
|
284
|
+
title: "Hello World",
|
|
285
|
+
version: "1.0.0"
|
|
286
|
+
},
|
|
287
|
+
paths: {
|
|
288
|
+
"/foobar": {
|
|
289
|
+
post: {
|
|
290
|
+
responses: {
|
|
291
|
+
"201": {
|
|
292
|
+
description: "OK",
|
|
293
|
+
content: {
|
|
294
|
+
"application/json": {
|
|
295
|
+
example: {
|
|
296
|
+
foo: "bar"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
const server = await createMockServer({
|
|
307
|
+
specification
|
|
308
|
+
});
|
|
309
|
+
const response = await server.request("/foobar", {
|
|
310
|
+
method: "POST"
|
|
311
|
+
});
|
|
312
|
+
expect(response.status).toBe(201);
|
|
313
|
+
expect(await response.json()).toMatchObject({
|
|
314
|
+
foo: "bar"
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
it("POST /foobar/{id} -> example JSON", async () => {
|
|
318
|
+
const specification = {
|
|
319
|
+
openapi: "3.1.0",
|
|
320
|
+
info: {
|
|
321
|
+
title: "Hello World",
|
|
322
|
+
version: "1.0.0"
|
|
323
|
+
},
|
|
324
|
+
paths: {
|
|
325
|
+
"/foobar/{id}": {
|
|
326
|
+
get: {
|
|
327
|
+
responses: {
|
|
328
|
+
"200": {
|
|
329
|
+
description: "OK",
|
|
330
|
+
content: {
|
|
331
|
+
"application/json": {
|
|
332
|
+
example: {
|
|
333
|
+
foo: "bar"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
const server = await createMockServer({
|
|
344
|
+
specification
|
|
345
|
+
});
|
|
346
|
+
const response = await server.request("/foobar/123");
|
|
347
|
+
expect(response.status).toBe(200);
|
|
348
|
+
expect(await response.json()).toMatchObject({
|
|
349
|
+
foo: "bar"
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
it("POST /foobar/{id} -> uses dynamic ID", async () => {
|
|
353
|
+
const specification = {
|
|
354
|
+
openapi: "3.1.0",
|
|
355
|
+
info: {
|
|
356
|
+
title: "Hello World",
|
|
357
|
+
version: "1.0.0"
|
|
358
|
+
},
|
|
359
|
+
paths: {
|
|
360
|
+
"/foobar/{id}": {
|
|
361
|
+
get: {
|
|
362
|
+
responses: {
|
|
363
|
+
"200": {
|
|
364
|
+
description: "OK",
|
|
365
|
+
content: {
|
|
366
|
+
"application/json": {
|
|
367
|
+
schema: {
|
|
368
|
+
type: "object",
|
|
369
|
+
properties: {
|
|
370
|
+
id: {
|
|
371
|
+
"type": "number",
|
|
372
|
+
"example": "bar",
|
|
373
|
+
"x-variable": "id"
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
const server = await createMockServer({
|
|
386
|
+
specification
|
|
387
|
+
});
|
|
388
|
+
const response = await server.request("/foobar/123");
|
|
389
|
+
expect(await response.json()).toMatchObject({
|
|
390
|
+
id: 123
|
|
391
|
+
});
|
|
392
|
+
expect(response.status).toBe(200);
|
|
393
|
+
});
|
|
394
|
+
it("GET /foobar -> example from schema", async () => {
|
|
395
|
+
const specification = {
|
|
396
|
+
openapi: "3.1.0",
|
|
397
|
+
info: {
|
|
398
|
+
title: "Hello World",
|
|
399
|
+
version: "1.0.0"
|
|
400
|
+
},
|
|
401
|
+
paths: {
|
|
402
|
+
"/foobar": {
|
|
403
|
+
get: {
|
|
404
|
+
responses: {
|
|
405
|
+
"200": {
|
|
406
|
+
description: "OK",
|
|
407
|
+
content: {
|
|
408
|
+
"application/json": {
|
|
409
|
+
schema: {
|
|
410
|
+
type: "object",
|
|
411
|
+
properties: {
|
|
412
|
+
foo: {
|
|
413
|
+
type: "string",
|
|
414
|
+
example: "bar"
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
const server = await createMockServer({
|
|
427
|
+
specification
|
|
428
|
+
});
|
|
429
|
+
const response = await server.request("/foobar");
|
|
430
|
+
expect(response.status).toBe(200);
|
|
431
|
+
expect(await response.json()).toMatchObject({
|
|
432
|
+
foo: "bar"
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
it("GET /foobar/{id} -> example from schema", async () => {
|
|
436
|
+
const specification = {
|
|
437
|
+
openapi: "3.1.0",
|
|
438
|
+
info: {
|
|
439
|
+
title: "Hello World",
|
|
440
|
+
version: "1.0.0"
|
|
441
|
+
},
|
|
442
|
+
paths: {
|
|
443
|
+
"/foobar/{id}": {
|
|
444
|
+
get: {
|
|
445
|
+
responses: {
|
|
446
|
+
"200": {
|
|
447
|
+
description: "OK",
|
|
448
|
+
content: {
|
|
449
|
+
"application/json": {
|
|
450
|
+
schema: {
|
|
451
|
+
type: "object",
|
|
452
|
+
properties: {
|
|
453
|
+
foo: {
|
|
454
|
+
type: "string",
|
|
455
|
+
example: "bar"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
const server = await createMockServer({
|
|
468
|
+
specification
|
|
469
|
+
});
|
|
470
|
+
const response = await server.request("/foobar/123");
|
|
471
|
+
expect(response.status).toBe(200);
|
|
472
|
+
expect(await response.json()).toMatchObject({
|
|
473
|
+
foo: "bar"
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
it("has CORS headers", async () => {
|
|
477
|
+
const specification = {
|
|
478
|
+
openapi: "3.1.0",
|
|
479
|
+
info: {
|
|
480
|
+
title: "Hello World",
|
|
481
|
+
version: "1.0.0"
|
|
482
|
+
},
|
|
483
|
+
paths: {
|
|
484
|
+
"/foobar": {
|
|
485
|
+
get: {
|
|
486
|
+
responses: {
|
|
487
|
+
"200": {
|
|
488
|
+
description: "OK",
|
|
489
|
+
content: {
|
|
490
|
+
"application/json": {
|
|
491
|
+
example: {
|
|
492
|
+
foo: "bar"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const server = await createMockServer({
|
|
503
|
+
specification
|
|
504
|
+
});
|
|
505
|
+
let response = await server.request("/foobar", {
|
|
506
|
+
method: "OPTIONS",
|
|
507
|
+
headers: {
|
|
508
|
+
origin: "https://example.com"
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
expect(response.status).toBe(204);
|
|
512
|
+
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("*");
|
|
513
|
+
const allowMethodsHeader = response.headers.get("Access-Control-Allow-Methods");
|
|
514
|
+
expect(allowMethodsHeader).toBeTypeOf("string");
|
|
515
|
+
expect(allowMethodsHeader?.split(",").sort()).toStrictEqual(
|
|
516
|
+
["GET", "HEAD", "PUT", "POST", "DELETE", "PATCH"].sort()
|
|
517
|
+
);
|
|
518
|
+
response = await server.request("/foobar", {
|
|
519
|
+
headers: {
|
|
520
|
+
origin: "https://example.com"
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
expect(response.status).toBe(200);
|
|
524
|
+
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("*");
|
|
525
|
+
expect(await response.json()).toMatchObject({
|
|
526
|
+
foo: "bar"
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
it("adds headers", async () => {
|
|
530
|
+
const specification = {
|
|
531
|
+
openapi: "3.1.0",
|
|
532
|
+
info: {
|
|
533
|
+
title: "Hello World",
|
|
534
|
+
version: "1.0.0"
|
|
535
|
+
},
|
|
536
|
+
paths: {
|
|
537
|
+
"/foobar": {
|
|
538
|
+
get: {
|
|
539
|
+
responses: {
|
|
540
|
+
"200": {
|
|
541
|
+
description: "OK",
|
|
542
|
+
headers: {
|
|
543
|
+
"X-Custom": {
|
|
544
|
+
schema: {
|
|
545
|
+
type: "string",
|
|
546
|
+
example: "foobar"
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
const server = await createMockServer({
|
|
557
|
+
specification
|
|
558
|
+
});
|
|
559
|
+
const response = await server.request("/foobar");
|
|
560
|
+
expect(response.status).toBe(200);
|
|
561
|
+
expect(response.headers.get("X-Custom")).toBe("foobar");
|
|
562
|
+
});
|
|
563
|
+
it("handles redirect headers", async () => {
|
|
564
|
+
const specification = {
|
|
565
|
+
openapi: "3.1.0",
|
|
566
|
+
info: {
|
|
567
|
+
title: "Hello World",
|
|
568
|
+
version: "1.0.0"
|
|
569
|
+
},
|
|
570
|
+
paths: {
|
|
571
|
+
"/redirect": {
|
|
572
|
+
get: {
|
|
573
|
+
responses: {
|
|
574
|
+
"301": {
|
|
575
|
+
description: "Moved Permanently",
|
|
576
|
+
headers: {
|
|
577
|
+
Location: {
|
|
578
|
+
schema: {
|
|
579
|
+
type: "string",
|
|
580
|
+
example: "/new-location"
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
const server = await createMockServer({
|
|
591
|
+
specification
|
|
592
|
+
});
|
|
593
|
+
const response = await server.request("/redirect");
|
|
594
|
+
expect(response.status).toBe(301);
|
|
595
|
+
expect(response.headers.get("Location")).toBe("/new-location");
|
|
596
|
+
});
|
|
597
|
+
});
|
|
598
|
+
//# sourceMappingURL=createMockServer.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/createMockServer.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { createMockServer } from './createMockServer'\n\ndescribe('createMockServer', () => {\n it('GET /foobar -> example JSON', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('GET /foobar -> omits writeOnly properties in responses', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n readOnly: true,\n example: 1,\n },\n visible: {\n type: 'boolean',\n example: true,\n },\n password: {\n type: 'string',\n writeOnly: true,\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n\n const data = await response.json()\n\n expect(data).not.toHaveProperty('password')\n expect(data).toStrictEqual({\n id: 1,\n visible: true,\n })\n })\n\n it('GET /foobar -> return HTML if accepted', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n 'text/html': {\n example: 'foobar',\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar', {\n headers: {\n Accept: 'text/html',\n },\n })\n\n expect(response.status).toBe(200)\n expect(await response.text()).toBe('foobar')\n })\n\n it('GET /foobar -> fall back to JSON', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n 'text/html': {\n example: 'foobar',\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('GET /foobar -> XML', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/xml': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n expect(await response.text()).toContain('<foo>bar</foo>')\n })\n\n it('uses http verbs only to register routes', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n summary: '',\n description: '',\n parameters: {},\n servers: {},\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('POST /foobar -> example JSON', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar', {\n method: 'POST',\n })\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('POST /foobar -> return 201', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n responses: {\n '201': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar', {\n method: 'POST',\n })\n\n expect(response.status).toBe(201)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('POST /foobar/{id} -> example JSON', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar/{id}': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar/123')\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('POST /foobar/{id} -> uses dynamic ID', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar/{id}': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n properties: {\n id: {\n 'type': 'number',\n 'example': 'bar',\n 'x-variable': 'id',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar/123')\n\n expect(await response.json()).toMatchObject({\n id: 123,\n })\n expect(response.status).toBe(200)\n })\n\n it('GET /foobar -> example from schema', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n properties: {\n foo: {\n type: 'string',\n example: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('GET /foobar/{id} -> example from schema', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar/{id}': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n properties: {\n foo: {\n type: 'string',\n example: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar/123')\n\n expect(response.status).toBe(200)\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('has CORS headers', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n content: {\n 'application/json': {\n example: {\n foo: 'bar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n // Options request\n let response = await server.request('/foobar', {\n method: 'OPTIONS',\n headers: {\n origin: 'https://example.com',\n },\n })\n\n expect(response.status).toBe(204)\n\n expect(response.headers.get('Access-Control-Allow-Origin')).toBe('*')\n\n const allowMethodsHeader = response.headers.get('Access-Control-Allow-Methods')\n expect(allowMethodsHeader).toBeTypeOf('string')\n expect(allowMethodsHeader?.split(',').sort()).toStrictEqual(\n ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH'].sort(),\n )\n\n // Get request\n response = await server.request('/foobar', {\n headers: {\n origin: 'https://example.com',\n },\n })\n\n expect(response.status).toBe(200)\n expect(response.headers.get('Access-Control-Allow-Origin')).toBe('*')\n\n expect(await response.json()).toMatchObject({\n foo: 'bar',\n })\n })\n\n it('adds headers', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n get: {\n responses: {\n '200': {\n description: 'OK',\n headers: {\n 'X-Custom': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/foobar')\n\n expect(response.status).toBe(200)\n expect(response.headers.get('X-Custom')).toBe('foobar')\n })\n\n it('handles redirect headers', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/redirect': {\n get: {\n responses: {\n '301': {\n description: 'Moved Permanently',\n headers: {\n Location: {\n schema: {\n type: 'string',\n example: '/new-location',\n },\n },\n },\n },\n },\n },\n },\n },\n }\n\n const server = await createMockServer({\n specification,\n })\n\n const response = await server.request('/redirect')\n\n expect(response.status).toBe(301)\n expect(response.headers.get('Location')).toBe('/new-location')\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,wBAAwB;AAEjC,SAAS,oBAAoB,MAAM;AACjC,KAAG,+BAA+B,YAAY;AAC5C,UAAM,gBAAgB;AAAA,MACpB,SAAS;AAAA,MACT,MAAM;AAAA,QACJ,OAAO;AAAA,QACP,SAAS;AAAA,MACX;AAAA,MACA,OAAO;AAAA,QACL,WAAW;AAAA,UACT,KAAK;AAAA,YACH,WAAW;AAAA,cACT,OAAO;AAAA,gBACL,aAAa;AAAA,gBACb,SAAS;AAAA,kBACP,oBAAoB;AAAA,oBAClB,SAAS;AAAA,sBACP,KAAK;AAAA,oBACP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
|
-
export { createMockServer } from './createMockServer.
|
|
1
|
+
export { createMockServer } from './createMockServer.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
CHANGED