@hy_ong/zod-kit 0.0.4 → 0.0.6

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.
Files changed (59) hide show
  1. package/.claude/settings.local.json +28 -0
  2. package/LICENSE +21 -0
  3. package/README.md +465 -97
  4. package/debug.js +21 -0
  5. package/debug.ts +16 -0
  6. package/dist/index.cjs +3127 -146
  7. package/dist/index.d.cts +3021 -25
  8. package/dist/index.d.ts +3021 -25
  9. package/dist/index.js +3081 -144
  10. package/eslint.config.mts +8 -0
  11. package/package.json +10 -9
  12. package/src/config.ts +1 -1
  13. package/src/i18n/locales/en.json +161 -25
  14. package/src/i18n/locales/zh-TW.json +165 -26
  15. package/src/index.ts +17 -7
  16. package/src/validators/common/boolean.ts +191 -0
  17. package/src/validators/common/date.ts +299 -0
  18. package/src/validators/common/datetime.ts +673 -0
  19. package/src/validators/common/email.ts +313 -0
  20. package/src/validators/common/file.ts +384 -0
  21. package/src/validators/common/id.ts +471 -0
  22. package/src/validators/common/number.ts +319 -0
  23. package/src/validators/common/password.ts +386 -0
  24. package/src/validators/common/text.ts +271 -0
  25. package/src/validators/common/time.ts +600 -0
  26. package/src/validators/common/url.ts +347 -0
  27. package/src/validators/taiwan/business-id.ts +262 -0
  28. package/src/validators/taiwan/fax.ts +327 -0
  29. package/src/validators/taiwan/mobile.ts +242 -0
  30. package/src/validators/taiwan/national-id.ts +425 -0
  31. package/src/validators/taiwan/postal-code.ts +1049 -0
  32. package/src/validators/taiwan/tel.ts +330 -0
  33. package/tests/common/boolean.test.ts +340 -92
  34. package/tests/common/date.test.ts +458 -0
  35. package/tests/common/datetime.test.ts +693 -0
  36. package/tests/common/email.test.ts +232 -60
  37. package/tests/common/file.test.ts +479 -0
  38. package/tests/common/id.test.ts +535 -0
  39. package/tests/common/number.test.ts +230 -60
  40. package/tests/common/password.test.ts +271 -44
  41. package/tests/common/text.test.ts +210 -13
  42. package/tests/common/time.test.ts +528 -0
  43. package/tests/common/url.test.ts +492 -67
  44. package/tests/taiwan/business-id.test.ts +240 -0
  45. package/tests/taiwan/fax.test.ts +463 -0
  46. package/tests/taiwan/mobile.test.ts +373 -0
  47. package/tests/taiwan/national-id.test.ts +435 -0
  48. package/tests/taiwan/postal-code.test.ts +705 -0
  49. package/tests/taiwan/tel.test.ts +467 -0
  50. package/eslint.config.mjs +0 -10
  51. package/src/common/boolean.ts +0 -36
  52. package/src/common/date.ts +0 -43
  53. package/src/common/email.ts +0 -44
  54. package/src/common/integer.ts +0 -46
  55. package/src/common/number.ts +0 -37
  56. package/src/common/password.ts +0 -33
  57. package/src/common/text.ts +0 -34
  58. package/src/common/url.ts +0 -37
  59. package/tests/common/integer.test.ts +0 -90
@@ -1,69 +1,494 @@
1
- import { describe, it, expect, beforeEach } from "vitest"
2
- import { setLocale, url, Locale } from "../../src"
3
-
4
- const locales = [
5
- {
6
- locale: "en",
7
- messages: {
8
- required: "Required",
9
- min: "Must be at least 20 characters",
10
- max: "Must be at most 10 characters",
11
- includes: "Must include company",
12
- invalid: "Invalid format",
13
- },
14
- },
15
- {
16
- locale: "zh-TW",
17
- messages: {
18
- required: "必填",
19
- min: "長度至少 20 字元",
20
- max: "長度最多 10 字元",
21
- includes: "必須包含「company」",
22
- invalid: "格式錯誤",
23
- },
24
- },
25
- ] as const
26
-
27
- describe.each(locales)("url() locale: $locale", ({ locale, messages }) => {
28
- beforeEach(() => setLocale(locale as Locale))
29
-
30
- it("should pass for valid url", () => {
31
- const schema = url()
32
- expect(schema.parse("https://example.com")).toBe("https://example.com")
33
- })
34
-
35
- it("should fail for invalid url format", () => {
36
- const schema = url()
37
- expect(() => schema.parse("invalid-url")).toThrow(messages.invalid)
38
- })
39
-
40
- it("should enforce required when set", () => {
41
- const schema = url({ required: true })
42
- expect(() => schema.parse("")).toThrow(messages.required)
43
- expect(() => schema.parse(null)).toThrow(messages.required)
44
- expect(() => schema.parse(undefined)).toThrow(messages.required)
45
- })
46
-
47
- it("should allow null if not required", () => {
48
- const schema = url({ required: false })
49
- expect(schema.parse("")).toBe(null)
50
- expect(schema.parse(null)).toBe(null)
51
- expect(schema.parse(undefined)).toBe(null)
52
- })
53
-
54
- it("should enforce max length", () => {
55
- const schema = url({ max: 10 })
56
- expect(() => schema.parse("https://verylongurl.com")).toThrow(messages.max)
57
- })
58
-
59
- it("should enforce min length", () => {
60
- const schema = url({ min: 20 })
61
- expect(() => schema.parse("https://short.co")).toThrow(messages.min)
62
- })
63
-
64
- it("should enforce includes", () => {
65
- const schema = url({ includes: "company" })
66
- expect(schema.parse("https://company.com")).toBe("https://company.com")
67
- expect(() => schema.parse("https://other.com")).toThrow(messages.includes)
1
+ import { describe, it, expect } from "vitest"
2
+ import { setLocale, url } from "../../src"
3
+
4
+ describe("url", () => {
5
+ describe("basic validation", () => {
6
+ it("should validate valid URL", () => {
7
+ const schema = url()
8
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
9
+ })
10
+
11
+ it("should validate http URL", () => {
12
+ const schema = url()
13
+ expect(schema.parse("http://example.com")).toBe("http://example.com")
14
+ })
15
+
16
+ it("should validate URL with path", () => {
17
+ const schema = url()
18
+ expect(schema.parse("https://example.com/path")).toBe("https://example.com/path")
19
+ })
20
+
21
+ it("should validate URL with query parameters", () => {
22
+ const schema = url()
23
+ expect(schema.parse("https://example.com?param=value")).toBe("https://example.com?param=value")
24
+ })
25
+
26
+ it("should validate URL with fragment", () => {
27
+ const schema = url()
28
+ expect(schema.parse("https://example.com#section")).toBe("https://example.com#section")
29
+ })
30
+
31
+ it("should reject invalid URL format", () => {
32
+ const schema = url()
33
+ expect(() => schema.parse("invalid-url")).toThrow()
34
+ })
35
+
36
+ it("should reject empty string", () => {
37
+ const schema = url()
38
+ expect(() => schema.parse("")).toThrow()
39
+ })
40
+
41
+ it("should reject null", () => {
42
+ const schema = url()
43
+ expect(() => schema.parse(null)).toThrow()
44
+ })
45
+
46
+ it("should reject undefined", () => {
47
+ const schema = url()
48
+ expect(() => schema.parse(undefined)).toThrow()
49
+ })
50
+ })
51
+
52
+ describe("optional", () => {
53
+ it("should allow null when not required", () => {
54
+ const schema = url({ required: false })
55
+ expect(schema.parse(null)).toBe(null)
56
+ })
57
+
58
+ it("should allow empty string when not required", () => {
59
+ const schema = url({ required: false })
60
+ expect(schema.parse("")).toBe(null)
61
+ })
62
+
63
+ it("should allow undefined when not required", () => {
64
+ const schema = url({ required: false })
65
+ expect(schema.parse(undefined)).toBe(null)
66
+ })
67
+
68
+ it("should validate valid URL when not required", () => {
69
+ const schema = url({ required: false })
70
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
71
+ })
72
+ })
73
+
74
+ describe("length validation", () => {
75
+ it("should accept URL with valid min length", () => {
76
+ const schema = url({ min: 10 })
77
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
78
+ })
79
+
80
+ it("should reject URL below min length", () => {
81
+ const schema = url({ min: 30 })
82
+ expect(() => schema.parse("https://short.co")).toThrow()
83
+ })
84
+
85
+ it("should accept URL with valid max length", () => {
86
+ const schema = url({ max: 30 })
87
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
88
+ })
89
+
90
+ it("should reject URL above max length", () => {
91
+ const schema = url({ max: 10 })
92
+ expect(() => schema.parse("https://verylongurl.com")).toThrow()
93
+ })
94
+
95
+ it("should accept URL within range", () => {
96
+ const schema = url({ min: 10, max: 30 })
97
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
98
+ })
99
+ })
100
+
101
+ describe("includes/excludes validation", () => {
102
+ it("should accept URL containing required substring", () => {
103
+ const schema = url({ includes: "company" })
104
+ expect(schema.parse("https://company.example.com")).toBe("https://company.example.com")
105
+ })
106
+
107
+ it("should reject URL not containing required substring", () => {
108
+ const schema = url({ includes: "company" })
109
+ expect(() => schema.parse("https://other.com")).toThrow()
110
+ })
111
+
112
+ it("should accept URL not containing excluded substring", () => {
113
+ const schema = url({ excludes: "banned" })
114
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
115
+ })
116
+
117
+ it("should reject URL containing excluded substring", () => {
118
+ const schema = url({ excludes: "banned" })
119
+ expect(() => schema.parse("https://banned.com")).toThrow()
120
+ })
121
+
122
+ it("should handle multiple excluded substrings as array", () => {
123
+ const schema = url({ excludes: ["banned", "blocked"] })
124
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
125
+ expect(() => schema.parse("https://banned.com")).toThrow()
126
+ expect(() => schema.parse("https://blocked.com")).toThrow()
127
+ })
128
+ })
129
+
130
+ describe("protocol validation", () => {
131
+ it("should accept allowed protocols", () => {
132
+ const schema = url({ protocols: ["https", "http"] })
133
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
134
+ expect(schema.parse("http://example.com")).toBe("http://example.com")
135
+ })
136
+
137
+ it("should reject disallowed protocols", () => {
138
+ const schema = url({ protocols: ["https"] })
139
+ expect(() => schema.parse("http://example.com")).toThrow()
140
+ })
141
+
142
+ it("should accept ftp protocol when allowed", () => {
143
+ const schema = url({ protocols: ["ftp"] })
144
+ expect(schema.parse("ftp://files.example.com")).toBe("ftp://files.example.com")
145
+ })
146
+ })
147
+
148
+ describe("domain validation", () => {
149
+ it("should accept allowed domains", () => {
150
+ const schema = url({ allowedDomains: ["example.com", "test.org"] })
151
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
152
+ expect(schema.parse("https://sub.example.com")).toBe("https://sub.example.com")
153
+ })
154
+
155
+ it("should reject disallowed domains", () => {
156
+ const schema = url({ allowedDomains: ["example.com"] })
157
+ expect(() => schema.parse("https://other.com")).toThrow()
158
+ })
159
+
160
+ it("should reject blocked domains", () => {
161
+ const schema = url({ blockedDomains: ["blocked.com", "spam.org"] })
162
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
163
+ expect(() => schema.parse("https://blocked.com")).toThrow()
164
+ expect(() => schema.parse("https://sub.blocked.com")).toThrow()
165
+ })
166
+ })
167
+
168
+ describe("port validation", () => {
169
+ it("should accept allowed ports", () => {
170
+ const schema = url({ allowedPorts: [80, 443, 8080] })
171
+ expect(schema.parse("https://example.com")).toBe("https://example.com") // 443
172
+ expect(schema.parse("http://example.com")).toBe("http://example.com") // 80
173
+ expect(schema.parse("https://example.com:8080")).toBe("https://example.com:8080")
174
+ })
175
+
176
+ it("should reject disallowed ports", () => {
177
+ const schema = url({ allowedPorts: [443] })
178
+ expect(() => schema.parse("http://example.com")).toThrow() // Port 80
179
+ })
180
+
181
+ it("should reject blocked ports", () => {
182
+ const schema = url({ blockedPorts: [80] })
183
+ expect(schema.parse("https://example.com")).toBe("https://example.com") // 443
184
+ expect(() => schema.parse("http://example.com")).toThrow() // Port 80
185
+ })
186
+ })
187
+
188
+ describe("path validation", () => {
189
+ it("should accept path starting with required prefix", () => {
190
+ const schema = url({ pathStartsWith: "/api" })
191
+ expect(schema.parse("https://example.com/api/users")).toBe("https://example.com/api/users")
192
+ })
193
+
194
+ it("should reject path not starting with required prefix", () => {
195
+ const schema = url({ pathStartsWith: "/api" })
196
+ expect(() => schema.parse("https://example.com/web/users")).toThrow()
197
+ })
198
+
199
+ it("should accept path ending with required suffix", () => {
200
+ const schema = url({ pathEndsWith: ".json" })
201
+ expect(schema.parse("https://example.com/api/data.json")).toBe("https://example.com/api/data.json")
202
+ })
203
+
204
+ it("should reject path not ending with required suffix", () => {
205
+ const schema = url({ pathEndsWith: ".json" })
206
+ expect(() => schema.parse("https://example.com/api/data.xml")).toThrow()
207
+ })
208
+ })
209
+
210
+ describe("query validation", () => {
211
+ it("should accept URL with query when required", () => {
212
+ const schema = url({ mustHaveQuery: true })
213
+ expect(schema.parse("https://example.com?param=value")).toBe("https://example.com?param=value")
214
+ })
215
+
216
+ it("should reject URL without query when required", () => {
217
+ const schema = url({ mustHaveQuery: true })
218
+ expect(() => schema.parse("https://example.com")).toThrow()
219
+ })
220
+
221
+ it("should accept URL without query when forbidden", () => {
222
+ const schema = url({ mustNotHaveQuery: true })
223
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
224
+ })
225
+
226
+ it("should reject URL with query when forbidden", () => {
227
+ const schema = url({ mustNotHaveQuery: true })
228
+ expect(() => schema.parse("https://example.com?param=value")).toThrow()
229
+ })
230
+ })
231
+
232
+ describe("fragment validation", () => {
233
+ it("should accept URL with fragment when required", () => {
234
+ const schema = url({ mustHaveFragment: true })
235
+ expect(schema.parse("https://example.com#section")).toBe("https://example.com#section")
236
+ })
237
+
238
+ it("should reject URL without fragment when required", () => {
239
+ const schema = url({ mustHaveFragment: true })
240
+ expect(() => schema.parse("https://example.com")).toThrow()
241
+ })
242
+
243
+ it("should accept URL without fragment when forbidden", () => {
244
+ const schema = url({ mustNotHaveFragment: true })
245
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
246
+ })
247
+
248
+ it("should reject URL with fragment when forbidden", () => {
249
+ const schema = url({ mustNotHaveFragment: true })
250
+ expect(() => schema.parse("https://example.com#section")).toThrow()
251
+ })
252
+ })
253
+
254
+ describe("localhost validation", () => {
255
+ it("should allow localhost by default", () => {
256
+ const schema = url()
257
+ expect(schema.parse("http://localhost:3000")).toBe("http://localhost:3000")
258
+ expect(schema.parse("http://127.0.0.1")).toBe("http://127.0.0.1")
259
+ expect(schema.parse("http://192.168.1.1")).toBe("http://192.168.1.1")
260
+ })
261
+
262
+ it("should block localhost when blockLocalhost is true", () => {
263
+ const schema = url({ blockLocalhost: true })
264
+ expect(schema.parse("https://example.com")).toBe("https://example.com")
265
+ expect(() => schema.parse("http://localhost:3000")).toThrow()
266
+ expect(() => schema.parse("http://127.0.0.1")).toThrow()
267
+ expect(() => schema.parse("http://192.168.1.1")).toThrow()
268
+ })
269
+
270
+ it("should block localhost when allowLocalhost is false", () => {
271
+ const schema = url({ allowLocalhost: false })
272
+ expect(() => schema.parse("http://localhost:3000")).toThrow()
273
+ })
274
+ })
275
+
276
+ describe("transform function", () => {
277
+ it("should apply custom transform function", () => {
278
+ const schema = url({ transform: (val) => val.replace("http://", "https://") })
279
+ expect(schema.parse("http://example.com")).toBe("https://example.com")
280
+ })
281
+
282
+ it("should apply transform before validation", () => {
283
+ const schema = url({
284
+ protocols: ["https"],
285
+ transform: (val) => val.replace("http://", "https://"),
286
+ })
287
+ expect(schema.parse("http://example.com")).toBe("https://example.com")
288
+ })
289
+
290
+ it("should work with other validations after transform", () => {
291
+ const schema = url({
292
+ includes: "https",
293
+ transform: (val) => val.replace("http://", "https://"),
294
+ })
295
+ expect(schema.parse("http://example.com")).toBe("https://example.com")
296
+ })
297
+ })
298
+
299
+ describe("default value", () => {
300
+ it("should use default value when input is empty", () => {
301
+ const schema = url({ defaultValue: "https://example.com" })
302
+ expect(schema.parse("")).toBe("https://example.com")
303
+ expect(schema.parse(null)).toBe("https://example.com")
304
+ expect(schema.parse(undefined)).toBe("https://example.com")
305
+ })
306
+
307
+ it("should use default value when optional and input is empty", () => {
308
+ const schema = url({ required: false, defaultValue: "https://example.com" })
309
+ expect(schema.parse("")).toBe("https://example.com")
310
+ expect(schema.parse(null)).toBe("https://example.com")
311
+ expect(schema.parse(undefined)).toBe("https://example.com")
312
+ })
313
+ })
314
+
315
+ describe("i18n custom messages", () => {
316
+ it("should use custom English messages", () => {
317
+ const schema = url({
318
+ i18n: {
319
+ en: { invalid: "Custom URL format error" },
320
+ "zh-TW": { invalid: "自定義 URL 格式錯誤" },
321
+ },
322
+ })
323
+
324
+ setLocale("en")
325
+ try {
326
+ schema.parse("invalid-url")
327
+ } catch (error: any) {
328
+ expect(error.issues[0].message).toBe("Custom URL format error")
329
+ }
330
+ })
331
+
332
+ it("should use custom Chinese messages", () => {
333
+ const schema = url({
334
+ i18n: {
335
+ en: { invalid: "Custom URL format error" },
336
+ "zh-TW": { invalid: "自定義 URL 格式錯誤" },
337
+ },
338
+ })
339
+
340
+ setLocale("zh-TW")
341
+ try {
342
+ schema.parse("invalid-url")
343
+ } catch (error: any) {
344
+ expect(error.issues[0].message).toBe("自定義 URL 格式錯誤")
345
+ }
346
+ })
347
+
348
+ it("should fallback to default messages when custom not provided", () => {
349
+ const schema = url({
350
+ i18n: {
351
+ en: { invalid: "Custom invalid error" },
352
+ "zh-TW": { invalid: "自定義無效錯誤" },
353
+ },
354
+ })
355
+
356
+ setLocale("en")
357
+ try {
358
+ schema.parse("")
359
+ } catch (error: any) {
360
+ expect(error.issues[0].message).toBe("Required") // Default message
361
+ }
362
+ })
363
+
364
+ it("should handle protocol validation with custom message", () => {
365
+ const schema = url({
366
+ protocols: ["https"],
367
+ i18n: {
368
+ en: { protocol: "Only HTTPS allowed!" },
369
+ "zh-TW": { protocol: "僅允許 HTTPS!" },
370
+ },
371
+ })
372
+
373
+ setLocale("en")
374
+ try {
375
+ schema.parse("http://example.com")
376
+ } catch (error: any) {
377
+ expect(error.issues[0].message).toBe("Only HTTPS allowed!")
378
+ }
379
+ })
380
+
381
+ it("should handle domain validation with custom message", () => {
382
+ const schema = url({
383
+ allowedDomains: ["example.com"],
384
+ i18n: {
385
+ en: { domain: "Only example.com allowed!" },
386
+ "zh-TW": { domain: "僅允許 example.com!" },
387
+ },
388
+ })
389
+
390
+ setLocale("en")
391
+ try {
392
+ schema.parse("https://other.com")
393
+ } catch (error: any) {
394
+ expect(error.issues[0].message).toBe("Only example.com allowed!")
395
+ }
396
+ })
397
+ })
398
+
399
+ describe("localization", () => {
400
+ it("should use English error messages", () => {
401
+ setLocale("en")
402
+ const schema = url()
403
+
404
+ try {
405
+ schema.parse("invalid")
406
+ } catch (error: any) {
407
+ expect(error.issues[0].message).toContain("Invalid URL format")
408
+ }
409
+ })
410
+
411
+ it("should use Chinese error messages", () => {
412
+ setLocale("zh-TW")
413
+ const schema = url()
414
+
415
+ try {
416
+ schema.parse("invalid")
417
+ } catch (error: any) {
418
+ expect(error.issues[0].message).toContain("無效的 URL 格式")
419
+ }
420
+ })
421
+
422
+ it("should use Chinese domain validation messages", () => {
423
+ setLocale("zh-TW")
424
+ const schema = url({ allowedDomains: ["example.com"] })
425
+
426
+ try {
427
+ schema.parse("https://other.com")
428
+ } catch (error: any) {
429
+ expect(error.issues[0].message).toContain("網域必須為")
430
+ }
431
+ })
432
+ })
433
+
434
+ describe("complex scenarios", () => {
435
+ it("should handle multiple validations combined", () => {
436
+ const schema = url({
437
+ protocols: ["https"],
438
+ allowedDomains: ["example.com"],
439
+ min: 20,
440
+ max: 50,
441
+ pathStartsWith: "/api",
442
+ mustHaveQuery: true,
443
+ })
444
+
445
+ expect(schema.parse("https://example.com/api/users?id=1")).toBe("https://example.com/api/users?id=1")
446
+
447
+ expect(() => schema.parse("http://example.com/api/users?id=1")).toThrow() // Wrong protocol
448
+ expect(() => schema.parse("https://other.com/api/users?id=1")).toThrow() // Wrong domain
449
+ expect(() => schema.parse("https://example.com/web/users?id=1")).toThrow() // Wrong path
450
+ expect(() => schema.parse("https://example.com/api/users")).toThrow() // No query
451
+ })
452
+
453
+ it("should handle localhost detection in private networks", () => {
454
+ const schema = url({ blockLocalhost: true })
455
+
456
+ expect(() => schema.parse("http://10.0.0.1")).toThrow()
457
+ expect(() => schema.parse("http://172.16.0.1")).toThrow()
458
+ expect(() => schema.parse("http://192.168.0.1")).toThrow()
459
+ expect(schema.parse("https://8.8.8.8")).toBe("https://8.8.8.8") // Public IP
460
+ })
461
+
462
+ it("should handle edge cases with ports", () => {
463
+ const schema = url({ allowedPorts: [443, 8080] })
464
+
465
+ expect(schema.parse("https://example.com")).toBe("https://example.com") // Default 443
466
+ expect(schema.parse("https://example.com:8080")).toBe("https://example.com:8080")
467
+ expect(() => schema.parse("https://example.com:3000")).toThrow()
468
+ })
469
+ })
470
+
471
+ describe("edge cases", () => {
472
+ it("should handle URLs with special characters", () => {
473
+ const schema = url()
474
+ expect(schema.parse("https://example.com/path%20with%20spaces")).toBe("https://example.com/path%20with%20spaces")
475
+ })
476
+
477
+ it("should handle international domain names", () => {
478
+ const schema = url()
479
+ expect(schema.parse("https://xn--fsq.com")).toBe("https://xn--fsq.com") // Internationalized domain
480
+ })
481
+
482
+ it("should handle URLs with authentication", () => {
483
+ const schema = url()
484
+ expect(schema.parse("https://user:pass@example.com")).toBe("https://user:pass@example.com")
485
+ })
486
+
487
+ it("should handle very long URLs", () => {
488
+ const longPath = "/very/long/path/" + "segment/".repeat(100)
489
+ const longUrl = `https://example.com${longPath}`
490
+ const schema = url()
491
+ expect(schema.parse(longUrl)).toBe(longUrl)
492
+ })
68
493
  })
69
494
  })