@schmock/faker 1.12.0 → 2.0.0

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.
@@ -3,12 +3,12 @@ import { generate, schemas, stats, validators } from "./test-utils";
3
3
 
4
4
  describe("Data Quality and Statistical Properties", () => {
5
5
  describe("Randomness and Distribution", () => {
6
- it("generates diverse values for string fields", () => {
6
+ it("generates diverse values for string fields", async () => {
7
7
  const schema = schemas.simple.object({
8
8
  text: schemas.simple.string(),
9
9
  });
10
10
 
11
- const samples = generate.samples<any>(schema, 100);
11
+ const samples = await generate.samples<any>(schema, 100);
12
12
  const values = samples.map((s) => s.text);
13
13
 
14
14
  // Should have high uniqueness
@@ -20,7 +20,7 @@ describe("Data Quality and Statistical Properties", () => {
20
20
  expect(entropy).toBeGreaterThan(4); // High randomness
21
21
  });
22
22
 
23
- it("generates well-distributed numeric values", () => {
23
+ it("generates well-distributed numeric values", async () => {
24
24
  const schema = schemas.simple.object({
25
25
  value: {
26
26
  type: "number",
@@ -29,7 +29,7 @@ describe("Data Quality and Statistical Properties", () => {
29
29
  },
30
30
  });
31
31
 
32
- const samples = generate.samples<any>(schema, 200);
32
+ const samples = await generate.samples<any>(schema, 200);
33
33
  const values = samples.map((s) => s.value);
34
34
 
35
35
  // Check distribution
@@ -48,7 +48,7 @@ describe("Data Quality and Statistical Properties", () => {
48
48
  expect(variance).toBeGreaterThan(100); // Good spread of values
49
49
  });
50
50
 
51
- it("generates diverse enum selections", () => {
51
+ it("generates diverse enum selections", async () => {
52
52
  const schema = schemas.simple.object({
53
53
  status: {
54
54
  type: "string",
@@ -56,7 +56,7 @@ describe("Data Quality and Statistical Properties", () => {
56
56
  },
57
57
  });
58
58
 
59
- const samples = generate.samples<any>(schema, 100);
59
+ const samples = await generate.samples<any>(schema, 100);
60
60
  const distribution = stats.distribution(samples.map((s) => s.status));
61
61
 
62
62
  // All enum values should be used
@@ -71,12 +71,12 @@ describe("Data Quality and Statistical Properties", () => {
71
71
  expect(maxCount / minCount).toBeLessThan(5);
72
72
  });
73
73
 
74
- it("generates diverse boolean values", () => {
74
+ it("generates diverse boolean values", async () => {
75
75
  const schema = schemas.simple.object({
76
76
  flag: { type: "boolean" },
77
77
  });
78
78
 
79
- const samples = generate.samples<any>(schema, 100);
79
+ const samples = await generate.samples<any>(schema, 100);
80
80
  const trueCount = samples.filter((s) => s.flag === true).length;
81
81
  const falseCount = samples.filter((s) => s.flag === false).length;
82
82
 
@@ -88,12 +88,12 @@ describe("Data Quality and Statistical Properties", () => {
88
88
  });
89
89
 
90
90
  describe("Format Compliance", () => {
91
- it("generates valid email formats consistently", () => {
91
+ it("generates valid email formats consistently", async () => {
92
92
  const schema = schemas.simple.object({
93
93
  email: { type: "string", format: "email" },
94
94
  });
95
95
 
96
- const samples = generate.samples<any>(schema, 50);
96
+ const samples = await generate.samples<any>(schema, 50);
97
97
 
98
98
  samples.forEach((sample) => {
99
99
  // RFC 5322 simplified regex
@@ -115,12 +115,12 @@ describe("Data Quality and Statistical Properties", () => {
115
115
  expect(uniqueness).toBeGreaterThan(0.8);
116
116
  });
117
117
 
118
- it("generates valid UUIDs consistently", () => {
118
+ it("generates valid UUIDs consistently", async () => {
119
119
  const schema = schemas.simple.object({
120
120
  id: { type: "string", format: "uuid" },
121
121
  });
122
122
 
123
- const samples = generate.samples<any>(schema, 50);
123
+ const samples = await generate.samples<any>(schema, 50);
124
124
  const uuidRegex =
125
125
  /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
126
126
 
@@ -134,12 +134,12 @@ describe("Data Quality and Statistical Properties", () => {
134
134
  expect(uniqueness).toBe(1);
135
135
  });
136
136
 
137
- it("generates valid dates with reasonable ranges", () => {
137
+ it("generates valid dates with reasonable ranges", async () => {
138
138
  const schema = schemas.simple.object({
139
139
  created: { type: "string", format: "date-time" },
140
140
  });
141
141
 
142
- const samples = generate.samples<any>(schema, 50);
142
+ const samples = await generate.samples<any>(schema, 50);
143
143
 
144
144
  samples.forEach((sample) => {
145
145
  const date = new Date(sample.created);
@@ -156,12 +156,12 @@ describe("Data Quality and Statistical Properties", () => {
156
156
  });
157
157
  });
158
158
 
159
- it("generates valid URLs when specified", () => {
159
+ it("generates valid URLs when specified", async () => {
160
160
  const schema = schemas.simple.object({
161
161
  website: { type: "string", format: "uri" },
162
162
  });
163
163
 
164
- const samples = generate.samples<any>(schema, 20);
164
+ const samples = await generate.samples<any>(schema, 20);
165
165
 
166
166
  samples.forEach((sample) => {
167
167
  if (sample.website) {
@@ -175,29 +175,29 @@ describe("Data Quality and Statistical Properties", () => {
175
175
  });
176
176
 
177
177
  describe("Constraint Satisfaction", () => {
178
- it("respects string length constraints consistently", () => {
178
+ it("respects string length constraints consistently", async () => {
179
179
  const schema = schemas.simple.object({
180
- username: {
180
+ xyzField: {
181
181
  type: "string",
182
182
  minLength: 5,
183
183
  maxLength: 15,
184
184
  },
185
185
  });
186
186
 
187
- const samples = generate.samples<any>(schema, 100);
187
+ const samples = await generate.samples<any>(schema, 100);
188
188
 
189
189
  samples.forEach((sample) => {
190
- expect(sample.username.length).toBeGreaterThanOrEqual(5);
191
- expect(sample.username.length).toBeLessThanOrEqual(15);
190
+ expect(sample.xyzField.length).toBeGreaterThanOrEqual(5);
191
+ expect(sample.xyzField.length).toBeLessThanOrEqual(15);
192
192
  });
193
193
 
194
194
  // Should use various lengths, not always min or max
195
- const lengths = samples.map((s) => s.username.length);
195
+ const lengths = samples.map((s) => s.xyzField.length);
196
196
  const uniqueLengths = new Set(lengths);
197
197
  expect(uniqueLengths.size).toBeGreaterThan(3);
198
198
  });
199
199
 
200
- it("respects numeric ranges with good distribution", () => {
200
+ it("respects numeric ranges with good distribution", async () => {
201
201
  const schema = schemas.simple.object({
202
202
  age: {
203
203
  type: "integer",
@@ -206,7 +206,7 @@ describe("Data Quality and Statistical Properties", () => {
206
206
  },
207
207
  });
208
208
 
209
- const samples = generate.samples<any>(schema, 100);
209
+ const samples = await generate.samples<any>(schema, 100);
210
210
  const ages = samples.map((s) => s.age);
211
211
 
212
212
  // All should be in range
@@ -225,7 +225,7 @@ describe("Data Quality and Statistical Properties", () => {
225
225
  expect(ages.some((age) => age >= 58)).toBe(true);
226
226
  });
227
227
 
228
- it("maintains array uniqueness when specified", () => {
228
+ it("maintains array uniqueness when specified", async () => {
229
229
  const schema = schemas.simple.object({
230
230
  tags: {
231
231
  type: "array",
@@ -236,7 +236,7 @@ describe("Data Quality and Statistical Properties", () => {
236
236
  },
237
237
  });
238
238
 
239
- const samples = generate.samples<any>(schema, 20);
239
+ const samples = await generate.samples<any>(schema, 20);
240
240
 
241
241
  samples.forEach((sample) => {
242
242
  expect(sample.tags).toHaveLength(5);
@@ -254,14 +254,14 @@ describe("Data Quality and Statistical Properties", () => {
254
254
  });
255
255
 
256
256
  describe("Realistic Data Generation", () => {
257
- it("generates realistic person names", () => {
257
+ it("generates realistic person names", async () => {
258
258
  const schema = schemas.simple.object({
259
259
  firstName: { type: "string" },
260
260
  lastName: { type: "string" },
261
261
  fullName: { type: "string" },
262
262
  });
263
263
 
264
- const samples = generate.samples<any>(schema, 50);
264
+ const samples = await generate.samples<any>(schema, 50);
265
265
 
266
266
  samples.forEach((sample) => {
267
267
  // First names should be properly capitalized and reasonable length
@@ -286,14 +286,14 @@ describe("Data Quality and Statistical Properties", () => {
286
286
  expect(validators.uniquenessRatio(firstNames)).toBeGreaterThan(0.5); // Slightly more forgiving
287
287
  });
288
288
 
289
- it("generates realistic addresses", () => {
289
+ it("generates realistic addresses", async () => {
290
290
  const schema = schemas.simple.object({
291
291
  street: { type: "string" },
292
292
  city: { type: "string" },
293
293
  zipcode: { type: "string" },
294
294
  });
295
295
 
296
- const samples = generate.samples<any>(schema, 30);
296
+ const samples = await generate.samples<any>(schema, 30);
297
297
 
298
298
  samples.forEach((sample) => {
299
299
  // Street addresses should have numbers and street names
@@ -310,7 +310,7 @@ describe("Data Quality and Statistical Properties", () => {
310
310
  });
311
311
  });
312
312
 
313
- it("generates consistent related data", () => {
313
+ it("generates consistent related data", async () => {
314
314
  const schema = schemas.simple.object({
315
315
  user: {
316
316
  type: "object",
@@ -323,7 +323,7 @@ describe("Data Quality and Statistical Properties", () => {
323
323
  },
324
324
  });
325
325
 
326
- const samples = generate.samples<any>(schema, 20);
326
+ const samples = await generate.samples<any>(schema, 20);
327
327
 
328
328
  samples.forEach((sample) => {
329
329
  // All fields should be present and be strings
@@ -340,7 +340,7 @@ describe("Data Quality and Statistical Properties", () => {
340
340
  });
341
341
 
342
342
  describe("Edge Cases and Boundaries", () => {
343
- it("handles empty strings when allowed", () => {
343
+ it("handles empty strings when allowed", async () => {
344
344
  const schema = schemas.simple.object({
345
345
  optional: {
346
346
  type: "string",
@@ -348,7 +348,7 @@ describe("Data Quality and Statistical Properties", () => {
348
348
  },
349
349
  });
350
350
 
351
- const samples = generate.samples<any>(schema, 50);
351
+ const samples = await generate.samples<any>(schema, 50);
352
352
 
353
353
  // All should be valid strings respecting minLength constraint
354
354
  samples.forEach((sample) => {
@@ -362,7 +362,7 @@ describe("Data Quality and Statistical Properties", () => {
362
362
  expect(uniqueLengths.size).toBeGreaterThan(1);
363
363
  });
364
364
 
365
- it("handles zero and negative numbers appropriately", () => {
365
+ it("handles zero and negative numbers appropriately", async () => {
366
366
  const schema = schemas.simple.object({
367
367
  balance: {
368
368
  type: "number",
@@ -371,7 +371,7 @@ describe("Data Quality and Statistical Properties", () => {
371
371
  },
372
372
  });
373
373
 
374
- const samples = generate.samples<any>(schema, 100);
374
+ const samples = await generate.samples<any>(schema, 100);
375
375
  const balances = samples.map((s) => s.balance);
376
376
 
377
377
  // Should include negative and positive values
@@ -387,7 +387,7 @@ describe("Data Quality and Statistical Properties", () => {
387
387
  });
388
388
  });
389
389
 
390
- it("generates boundary values occasionally", () => {
390
+ it("generates boundary values occasionally", async () => {
391
391
  const schema = schemas.simple.object({
392
392
  score: {
393
393
  type: "integer",
@@ -396,7 +396,7 @@ describe("Data Quality and Statistical Properties", () => {
396
396
  },
397
397
  });
398
398
 
399
- const samples = generate.samples<any>(schema, 200);
399
+ const samples = await generate.samples<any>(schema, 200);
400
400
  const scores = samples.map((s) => s.score);
401
401
 
402
402
  // Should respect the boundaries and generate diverse values
@@ -5,9 +5,9 @@ import { schemas } from "./test-utils";
5
5
 
6
6
  describe("Schema Error Handling", () => {
7
7
  describe("Validation Error Messages", () => {
8
- it("provides clear error for empty schemas", () => {
8
+ it("provides clear error for empty schemas", async () => {
9
9
  try {
10
- generateFromSchema({ schema: {} as any });
10
+ await generateFromSchema({ schema: {} as any });
11
11
  expect.fail("Should have thrown");
12
12
  } catch (error: any) {
13
13
  expect(error.name).toBe("SchemaValidationError");
@@ -16,9 +16,9 @@ describe("Schema Error Handling", () => {
16
16
  }
17
17
  });
18
18
 
19
- it("provides clear error for invalid types", () => {
19
+ it("provides clear error for invalid types", async () => {
20
20
  try {
21
- generateFromSchema({ schema: { type: "invalid" as any } });
21
+ await generateFromSchema({ schema: { type: "invalid" as any } });
22
22
  expect.fail("Should have thrown");
23
23
  } catch (error: any) {
24
24
  expect(error.name).toBe("SchemaValidationError");
@@ -28,9 +28,9 @@ describe("Schema Error Handling", () => {
28
28
  }
29
29
  });
30
30
 
31
- it("provides helpful suggestions for common mistakes", () => {
31
+ it("provides helpful suggestions for common mistakes", async () => {
32
32
  try {
33
- generateFromSchema({
33
+ await generateFromSchema({
34
34
  schema: {
35
35
  type: "object",
36
36
  properties: "should be object" as any,
@@ -45,9 +45,9 @@ describe("Schema Error Handling", () => {
45
45
  }
46
46
  });
47
47
 
48
- it("includes schema path in error messages", () => {
48
+ it("includes schema path in error messages", async () => {
49
49
  try {
50
- generateFromSchema({
50
+ await generateFromSchema({
51
51
  schema: {
52
52
  type: "object",
53
53
  properties: {
@@ -69,9 +69,9 @@ describe("Schema Error Handling", () => {
69
69
  }
70
70
  });
71
71
 
72
- it("validates faker method namespaces with helpful errors", () => {
72
+ it("validates faker method namespaces with helpful errors", async () => {
73
73
  try {
74
- generateFromSchema({
74
+ await generateFromSchema({
75
75
  schema: {
76
76
  type: "object",
77
77
  properties: {
@@ -89,9 +89,9 @@ describe("Schema Error Handling", () => {
89
89
  }
90
90
  });
91
91
 
92
- it("validates array schemas must have items", () => {
92
+ it("validates array schemas must have items", async () => {
93
93
  try {
94
- generateFromSchema({
94
+ await generateFromSchema({
95
95
  schema: {
96
96
  type: "array",
97
97
  items: null as any,
@@ -108,9 +108,9 @@ describe("Schema Error Handling", () => {
108
108
  });
109
109
 
110
110
  describe("Resource Limit Errors", () => {
111
- it("provides clear error for array size limits", () => {
111
+ it("provides clear error for array size limits", async () => {
112
112
  try {
113
- generateFromSchema({
113
+ await generateFromSchema({
114
114
  schema: {
115
115
  type: "array",
116
116
  items: { type: "string" },
@@ -125,10 +125,10 @@ describe("Schema Error Handling", () => {
125
125
  }
126
126
  });
127
127
 
128
- it("provides clear error for nesting depth", () => {
128
+ it("provides clear error for nesting depth", async () => {
129
129
  try {
130
130
  const deepSchema = schemas.nested.deep(15);
131
- generateFromSchema({ schema: deepSchema });
131
+ await generateFromSchema({ schema: deepSchema });
132
132
  expect.fail("Should have thrown");
133
133
  } catch (error: any) {
134
134
  // Should throw some kind of error for nesting depth
@@ -137,9 +137,9 @@ describe("Schema Error Handling", () => {
137
137
  }
138
138
  });
139
139
 
140
- it("detects memory risks from nested arrays", () => {
140
+ it("detects memory risks from nested arrays", async () => {
141
141
  try {
142
- generateFromSchema({
142
+ await generateFromSchema({
143
143
  schema: {
144
144
  type: "object",
145
145
  properties: {
@@ -171,9 +171,9 @@ describe("Schema Error Handling", () => {
171
171
  }
172
172
  });
173
173
 
174
- it("provides actionable error messages for limits", () => {
174
+ it("provides actionable error messages for limits", async () => {
175
175
  try {
176
- generateFromSchema({
176
+ await generateFromSchema({
177
177
  schema: {
178
178
  type: "array",
179
179
  items: { type: "string" },
@@ -190,9 +190,9 @@ describe("Schema Error Handling", () => {
190
190
  });
191
191
 
192
192
  describe("Schema Generation Errors", () => {
193
- it("wraps json-schema-faker errors appropriately", () => {
193
+ it("wraps json-schema-faker errors appropriately", async () => {
194
194
  try {
195
- generateFromSchema({
195
+ await generateFromSchema({
196
196
  schema: {
197
197
  type: "string",
198
198
  pattern: "[", // Invalid regex
@@ -206,7 +206,7 @@ describe("Schema Error Handling", () => {
206
206
  }
207
207
  });
208
208
 
209
- it("includes context in generation errors", () => {
209
+ it("includes context in generation errors", async () => {
210
210
  const plugin = fakerPlugin({
211
211
  schema: {
212
212
  type: "string",
@@ -226,7 +226,7 @@ describe("Schema Error Handling", () => {
226
226
  };
227
227
 
228
228
  try {
229
- plugin.process(context);
229
+ await plugin.process(context);
230
230
  expect.fail("Should have thrown");
231
231
  } catch (error: any) {
232
232
  // Should throw some kind of error
@@ -234,9 +234,9 @@ describe("Schema Error Handling", () => {
234
234
  }
235
235
  });
236
236
 
237
- it("handles circular reference errors", () => {
237
+ it("handles circular reference errors", async () => {
238
238
  try {
239
- generateFromSchema({
239
+ await generateFromSchema({
240
240
  schema: {
241
241
  type: "object",
242
242
  properties: {
@@ -251,9 +251,9 @@ describe("Schema Error Handling", () => {
251
251
  }
252
252
  });
253
253
 
254
- it("handles missing reference errors", () => {
254
+ it("handles missing reference errors", async () => {
255
255
  try {
256
- generateFromSchema({
256
+ await generateFromSchema({
257
257
  schema: {
258
258
  type: "object",
259
259
  properties: {
@@ -264,7 +264,7 @@ describe("Schema Error Handling", () => {
264
264
  expect.fail("Should have thrown");
265
265
  } catch (error: any) {
266
266
  // json-schema-faker throws its own error
267
- expect(error.message).toContain("not found");
267
+ expect(error.message).toContain("Unresolved $ref");
268
268
  }
269
269
  });
270
270
  });
@@ -282,13 +282,13 @@ describe("Schema Error Handling", () => {
282
282
  }
283
283
  });
284
284
 
285
- it("handles null context gracefully", () => {
285
+ it("handles null context gracefully", async () => {
286
286
  const plugin = fakerPlugin({
287
287
  schema: schemas.simple.object({ id: schemas.simple.number() }),
288
288
  });
289
289
 
290
290
  // Should not crash with null params
291
- const result = plugin.process({
291
+ const result = await plugin.process({
292
292
  method: "GET",
293
293
  path: "/test",
294
294
  params: null as any,
@@ -302,9 +302,9 @@ describe("Schema Error Handling", () => {
302
302
  expect(result.response).toHaveProperty("id");
303
303
  });
304
304
 
305
- it("preserves original error stack traces", () => {
305
+ it("preserves original error stack traces", async () => {
306
306
  try {
307
- generateFromSchema({
307
+ await generateFromSchema({
308
308
  schema: {
309
309
  type: "string",
310
310
  pattern: "[",
@@ -320,23 +320,23 @@ describe("Schema Error Handling", () => {
320
320
  });
321
321
 
322
322
  describe("Error Recovery", () => {
323
- it("can generate after validation errors", () => {
323
+ it("can generate after validation errors", async () => {
324
324
  // First attempt with invalid schema
325
325
  try {
326
- generateFromSchema({ schema: { type: "invalid" as any } });
326
+ await generateFromSchema({ schema: { type: "invalid" as any } });
327
327
  } catch (_error) {
328
328
  // Expected
329
329
  }
330
330
 
331
331
  // Should be able to generate with valid schema
332
- const result = generateFromSchema({
332
+ const result = await generateFromSchema({
333
333
  schema: schemas.simple.object({ id: schemas.simple.number() }),
334
334
  });
335
335
 
336
336
  expect(result).toHaveProperty("id");
337
337
  });
338
338
 
339
- it("plugin continues to work after errors", () => {
339
+ it("plugin continues to work after errors", async () => {
340
340
  const plugin = fakerPlugin({
341
341
  schema: schemas.simple.object({ id: schemas.simple.number() }),
342
342
  });
@@ -353,8 +353,8 @@ describe("Schema Error Handling", () => {
353
353
  };
354
354
 
355
355
  // Multiple calls should work
356
- const result1 = plugin.process(context);
357
- const result2 = plugin.process(context);
356
+ const result1 = await plugin.process(context);
357
+ const result2 = await plugin.process(context);
358
358
 
359
359
  expect(result1.response).toHaveProperty("id");
360
360
  expect(result2.response).toHaveProperty("id");
@@ -362,9 +362,9 @@ describe("Schema Error Handling", () => {
362
362
  });
363
363
 
364
364
  describe("Edge Case Error Handling", () => {
365
- it("handles deeply nested validation errors", () => {
365
+ it("handles deeply nested validation errors", async () => {
366
366
  try {
367
- generateFromSchema({
367
+ await generateFromSchema({
368
368
  schema: {
369
369
  type: "object",
370
370
  properties: {
@@ -399,9 +399,9 @@ describe("Schema Error Handling", () => {
399
399
  }
400
400
  });
401
401
 
402
- it("handles multiple validation errors (reports first)", () => {
402
+ it("handles multiple validation errors (reports first)", async () => {
403
403
  try {
404
- generateFromSchema({
404
+ await generateFromSchema({
405
405
  schema: {
406
406
  type: "invalid" as any,
407
407
  properties: "also invalid" as any,
@@ -415,19 +415,17 @@ describe("Schema Error Handling", () => {
415
415
  }
416
416
  });
417
417
 
418
- it("handles non-Error objects in catch blocks", () => {
418
+ it("handles non-Error objects in catch blocks", async () => {
419
419
  // This is more about the implementation being defensive
420
420
  const plugin = fakerPlugin({
421
421
  schema: schemas.simple.object({ id: schemas.simple.number() }),
422
422
  });
423
423
 
424
424
  // Even with weird inputs, should handle gracefully
425
- expect(() => {
426
- plugin.process({} as any);
427
- }).not.toThrow();
425
+ await expect(plugin.process({} as any)).resolves.not.toThrow();
428
426
  });
429
427
 
430
- it("handles schemas that generate invalid JSON", () => {
428
+ it("handles schemas that generate invalid JSON", async () => {
431
429
  // Some edge cases might generate circular structures
432
430
  const schema: JSONSchema7 = {
433
431
  type: "object",
@@ -436,7 +434,7 @@ describe("Schema Error Handling", () => {
436
434
  },
437
435
  };
438
436
 
439
- const result = generateFromSchema({ schema });
437
+ const result = await generateFromSchema({ schema });
440
438
 
441
439
  // Should be serializable
442
440
  expect(() => JSON.stringify(result)).not.toThrow();
@@ -444,18 +442,18 @@ describe("Schema Error Handling", () => {
444
442
  });
445
443
 
446
444
  describe("Error Message Quality", () => {
447
- it("uses consistent error message format", () => {
445
+ it("uses consistent error message format", async () => {
448
446
  const errors: any[] = [];
449
447
 
450
448
  // Collect various errors
451
449
  try {
452
- generateFromSchema({ schema: {} as any });
450
+ await generateFromSchema({ schema: {} as any });
453
451
  } catch (e) {
454
452
  errors.push(e);
455
453
  }
456
454
 
457
455
  try {
458
- generateFromSchema({ schema: { type: "invalid" as any } });
456
+ await generateFromSchema({ schema: { type: "invalid" as any } });
459
457
  } catch (e) {
460
458
  errors.push(e);
461
459
  }
@@ -469,9 +467,9 @@ describe("Schema Error Handling", () => {
469
467
  });
470
468
  });
471
469
 
472
- it("avoids exposing internal implementation details", () => {
470
+ it("avoids exposing internal implementation details", async () => {
473
471
  try {
474
- generateFromSchema({
472
+ await generateFromSchema({
475
473
  schema: {
476
474
  type: "string",
477
475
  pattern: "[",
@@ -487,9 +485,9 @@ describe("Schema Error Handling", () => {
487
485
  }
488
486
  });
489
487
 
490
- it("provides actionable error messages", () => {
488
+ it("provides actionable error messages", async () => {
491
489
  try {
492
- generateFromSchema({
490
+ await generateFromSchema({
493
491
  schema: {
494
492
  type: "object",
495
493
  properties: [] as any, // Wrong type