identifier-js 0.0.13 → 0.0.15

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.
@@ -1,604 +0,0 @@
1
- import { describe, expect, test } from 'vitest';
2
- import id from '../index.js';
3
-
4
- describe('isUri with hostnames', () => {
5
- test('Valid character ! (sub-delims) in uri reg_name', () => {
6
- expect(id.isUri('uri://exa!mple')).to.equal(true);
7
- });
8
-
9
- test('Valid character & (sub-delims) in uri reg_name', () => {
10
- expect(id.isUri('uri://exa&mple')).to.equal(true);
11
- });
12
-
13
- test('Valid character $ (sub-delims) in uri reg_name', () => {
14
- expect(id.isUri('uri://exa$mple')).to.equal(true);
15
- });
16
-
17
- test("Valid character ' (sub-delims) in uri reg_name", () => {
18
- expect(id.isUri("uri://exa'mple")).to.equal(true);
19
- });
20
-
21
- test('Valid character ( (sub-delims) in uri reg_name', () => {
22
- expect(id.isUri('uri://exa(mple')).to.equal(true);
23
- });
24
-
25
- test('Valid character ) (sub-delims) in uri reg_name', () => {
26
- expect(id.isUri('uri://exa)mple')).to.equal(true);
27
- });
28
-
29
- test('Valid character * (sub-delims) in uri reg_name', () => {
30
- expect(id.isUri('uri://exa*mple')).to.equal(true);
31
- });
32
-
33
- test('Valid character + (sub-delims) in uri reg_name', () => {
34
- expect(id.isUri('uri://exa+mple')).to.equal(true);
35
- });
36
-
37
- test('Valid character , (sub-delims) in uri reg_name', () => {
38
- expect(id.isUri('uri://exa,mple')).to.equal(true);
39
- });
40
-
41
- test('Valid character ; (sub-delims) in uri reg_name', () => {
42
- expect(id.isUri('uri://exa;mple')).to.equal(true);
43
- });
44
-
45
- test('Valid character = (sub-delims) in uri reg_name', () => {
46
- expect(id.isUri('uri://exa=mple')).to.equal(true);
47
- });
48
-
49
- test('Valid character - (unreserved) anywhere in uri reg_name', () => {
50
- expect(id.isUri('iri://-exa-mple-')).to.equal(true);
51
- });
52
-
53
- test('Valid character . multiple times (unreserved) in uri reg_name', () => {
54
- expect(id.isUri('uri://exa..mple')).to.equal(true);
55
- });
56
-
57
- test('Valid character ~ (unreserved) in uri reg_name', () => {
58
- expect(id.isUri('uri://exa~mple')).to.equal(true);
59
- });
60
-
61
- test('Valid character _ (unreserved) in uri reg_name', () => {
62
- expect(id.isUri('uri://exa_mple')).to.equal(true);
63
- });
64
-
65
- test('Valid character %20 (pct-encoded) in uri reg_name', () => {
66
- expect(id.isUri('uri://exa%20mple')).to.equal(true);
67
- });
68
-
69
- test('Invalid %GG (pct-encoded) in uri reg_name', () => {
70
- expect(() => id.isUri('uri://exa%GGmple')).to.throw(Error, 'Invalid URI: uri://exa%GGmple');
71
- });
72
-
73
- test('Valid label - alphanumeric', () => {
74
- expect(id.isUri('https://example')).to.equal(true);
75
- });
76
-
77
- test('Valid label - hyphen in middle', () => {
78
- expect(id.isUri('https://exa-mple')).to.equal(true);
79
- });
80
-
81
- test('Invalid label - hyphen at start', () => {
82
- expect(() => id.isUri('https://-example')).to.throw(Error, 'Invalid URI: https://-example');
83
- });
84
-
85
- test('Invalid label - hyphen at end', () => {
86
- expect(() => id.isUri('https://example-')).to.throw(Error, 'Invalid URI: https://example-');
87
- });
88
-
89
- test('Valid multiple labels', () => {
90
- expect(id.isUri('https://example-domain.com')).to.equal(true);
91
- });
92
-
93
- test('Invalid - leading dot', () => {
94
- expect(() => id.isUri('https://.example.com')).to.throw(Error, 'Invalid URI: https://.example.com');
95
- });
96
-
97
- test('Invalid - trailing dot', () => {
98
- expect(() => id.isUri('https://example.com.')).to.throw(Error, 'Invalid URI: https://example.com.');
99
- });
100
-
101
- test('Invalid - consecutive dots', () => {
102
- expect(() => id.isUri('https://example..com')).to.throw(Error, 'Invalid URI: https://example..com');
103
- });
104
-
105
- test('Invalid - unicode character', () => {
106
- expect(() => id.isUri('https://exämple')).to.throw(Error, 'Invalid URI: https://exämple');
107
- });
108
-
109
- test('Invalid - % character (pct_encoded) in http(s) reg_name', () => {
110
- expect(() => id.isUri('https://exa%20mple')).to.throw(Error, 'Invalid URI: https://exa%20mple');
111
- });
112
-
113
- test('Invalid - % character (pct_encoded) in ws(s) reg_name', () => {
114
- expect(() => id.isUri('wss://exa%20mple')).to.throw(Error, 'Invalid URI: wss://exa%20mple');
115
- });
116
-
117
- test('Invalid - % character (pct_encoded) in file reg_name', () => {
118
- expect(() => id.isUri('file://exa%20mple')).to.throw(Error, 'Invalid URI: file://exa%20mple');
119
- });
120
-
121
- test('Invalid - ~ character (unreserved) in http(s) reg_name', () => {
122
- expect(() => id.isUri('https://exa~mple')).to.throw(Error, 'Invalid URI: https://exa~mple');
123
- });
124
-
125
- test('Invalid - ~ character (unreserved) in ws(s) reg_name', () => {
126
- expect(() => id.isUri('wss://exa~mple')).to.throw(Error, 'Invalid URI: wss://exa~mple');
127
- });
128
-
129
- test('Invalid - ~ character (unreserved) in file reg_name', () => {
130
- expect(() => id.isUri('file://exa~mple')).to.throw(Error, 'Invalid URI: file://exa~mple');
131
- });
132
-
133
- test('Invalid - _ character (unreserved) in http(s) reg_name', () => {
134
- expect(() => id.isUri('https://exa_mple')).to.throw(Error, 'Invalid URI: https://exa_mple');
135
- });
136
-
137
- test('Invalid - _ character (unreserved) in ws(s) reg_name', () => {
138
- expect(() => id.isUri('wss://exa_mple')).to.throw(Error, 'Invalid URI: wss://exa_mple');
139
- });
140
-
141
- test('Invalid - _ character (unreserved) in file reg_name', () => {
142
- expect(() => id.isUri('file://exa_mple')).to.throw(Error, 'Invalid URI: file://exa_mple');
143
- });
144
-
145
- test('Invalid - ! character (sub-delims) in http(s) reg_name', () => {
146
- expect(() => id.isUri('https://exa!mple')).to.throw(Error, 'Invalid URI: https://exa!mple');
147
- });
148
-
149
- test('Invalid - ! character (sub-delims) in ws(s) reg_name', () => {
150
- expect(() => id.isUri('wss://exa!mple')).to.throw(Error, 'Invalid URI: wss://exa!mple');
151
- });
152
-
153
- test('Invalid - ! character (sub-delims) in file reg_name', () => {
154
- expect(() => id.isUri('file://exa!mple')).to.throw(Error, 'Invalid URI: file://exa!mple');
155
- });
156
-
157
- test('Invalid - & character (sub-delims) in http(s) reg_name', () => {
158
- expect(() => id.isUri('https://exa&mple')).to.throw(Error, 'Invalid URI: https://exa&mple');
159
- });
160
-
161
- test('Invalid - & character (sub-delims) in ws(s) reg_name', () => {
162
- expect(() => id.isUri('wss://exa&mple')).to.throw(Error, 'Invalid URI: wss://exa&mple');
163
- });
164
-
165
- test('Invalid - & character (sub-delims) in file reg_name', () => {
166
- expect(() => id.isUri('file://exa&mple')).to.throw(Error, 'Invalid URI: file://exa&mple');
167
- });
168
-
169
- test('Invalid - $ character (sub-delims) in http(s) reg_name', () => {
170
- expect(() => id.isUri('https://exa$mple')).to.throw(Error, 'Invalid URI: https://exa$mple');
171
- });
172
-
173
- test('Invalid - $ character (sub-delims) in ws(s) reg_name', () => {
174
- expect(() => id.isUri('wss://exa$mple')).to.throw(Error, 'Invalid URI: wss://exa$mple');
175
- });
176
-
177
- test('Invalid - $ character (sub-delims) in file reg_name', () => {
178
- expect(() => id.isUri('file://exa$mple')).to.throw(Error, 'Invalid URI: file://exa$mple');
179
- });
180
-
181
- test("Invalid - ' character (sub-delims) in http(s) reg_name", () => {
182
- expect(() => id.isUri("https://exa'mple")).to.throw(Error, "Invalid URI: https://exa'mple");
183
- });
184
-
185
- test("Invalid - ' character (sub-delims) in ws(s) reg_name", () => {
186
- expect(() => id.isUri("wss://exa'mple")).to.throw(Error, "Invalid URI: wss://exa'mple");
187
- });
188
-
189
- test("Invalid - ' character (sub-delims) in file reg_name", () => {
190
- expect(() => id.isUri("file://exa'mple")).to.throw(Error, "Invalid URI: file://exa'mple");
191
- });
192
-
193
- test('Invalid - ( character (sub-delims) in http(s) reg_name', () => {
194
- expect(() => id.isUri('https://exa(mple')).to.throw(Error, 'Invalid URI: https://exa(mple');
195
- });
196
-
197
- test('Invalid - ( character (sub-delims) in ws(s) reg_name', () => {
198
- expect(() => id.isUri('wss://exa(mple')).to.throw(Error, 'Invalid URI: wss://exa(mple');
199
- });
200
-
201
- test('Invalid - ( character (sub-delims) in file reg_name', () => {
202
- expect(() => id.isUri('file://exa(mple')).to.throw(Error, 'Invalid URI: file://exa(mple');
203
- });
204
-
205
- test('Invalid - ) character (sub-delims) in http(s) reg_name', () => {
206
- expect(() => id.isUri('https://exa)mple')).to.throw(Error, 'Invalid URI: https://exa)mple');
207
- });
208
-
209
- test('Invalid - ) character (sub-delims) in ws(s) reg_name', () => {
210
- expect(() => id.isUri('wss://exa)mple')).to.throw(Error, 'Invalid URI: wss://exa)mple');
211
- });
212
-
213
- test('Invalid - ) character (sub-delims) in file reg_name', () => {
214
- expect(() => id.isUri('file://exa)mple')).to.throw(Error, 'Invalid URI: file://exa)mple');
215
- });
216
-
217
- test('Invalid - * character (sub-delims) in http(s) reg_name', () => {
218
- expect(() => id.isUri('https://exa*mple')).to.throw(Error, 'Invalid URI: https://exa*mple');
219
- });
220
-
221
- test('Invalid - * character (sub-delims) in ws(s) reg_name', () => {
222
- expect(() => id.isUri('wss://exa*mple')).to.throw(Error, 'Invalid URI: wss://exa*mple');
223
- });
224
-
225
- test('Invalid - * character (sub-delims) in file reg_name', () => {
226
- expect(() => id.isUri('file://exa*mple')).to.throw(Error, 'Invalid URI: file://exa*mple');
227
- });
228
-
229
- test('Invalid - + character (sub-delims) in http(s) reg_name', () => {
230
- expect(() => id.isUri('https://exa+mple')).to.throw(Error, 'Invalid URI: https://exa+mple');
231
- });
232
-
233
- test('Invalid - + character (sub-delims) in ws(s) reg_name', () => {
234
- expect(() => id.isUri('wss://exa+mple')).to.throw(Error, 'Invalid URI: wss://exa+mple');
235
- });
236
-
237
- test('Invalid - + character (sub-delims) in file reg_name', () => {
238
- expect(() => id.isUri('file://exa+mple')).to.throw(Error, 'Invalid URI: file://exa+mple');
239
- });
240
-
241
- test('Invalid - , character (sub-delims) in http(s) reg_name', () => {
242
- expect(() => id.isUri('https://exa,mple')).to.throw(Error, 'Invalid URI: https://exa,mple');
243
- });
244
-
245
- test('Invalid - , character (sub-delims) in ws(s) reg_name', () => {
246
- expect(() => id.isUri('wss://exa,mple')).to.throw(Error, 'Invalid URI: wss://exa,mple');
247
- });
248
-
249
- test('Invalid - , character (sub-delims) in file reg_name', () => {
250
- expect(() => id.isUri('file://exa,mple')).to.throw(Error, 'Invalid URI: file://exa,mple');
251
- });
252
-
253
- test('Invalid - ; character (sub-delims) in http(s) reg_name', () => {
254
- expect(() => id.isUri('https://exa;mple')).to.throw(Error, 'Invalid URI: https://exa;mple');
255
- });
256
-
257
- test('Invalid - ; character (sub-delims) in ws(s) reg_name', () => {
258
- expect(() => id.isUri('wss://exa;mple')).to.throw(Error, 'Invalid URI: wss://exa;mple');
259
- });
260
-
261
- test('Invalid - ; character (sub-delims) in file reg_name', () => {
262
- expect(() => id.isUri('file://exa;mple')).to.throw(Error, 'Invalid URI: file://exa;mple');
263
- });
264
-
265
- test('Invalid - = character (sub-delims) in http(s) reg_name', () => {
266
- expect(() => id.isUri('https://exa=mple')).to.throw(Error, 'Invalid URI: https://exa=mple');
267
- });
268
-
269
- test('Invalid - = character (sub-delims) in ws(s) reg_name', () => {
270
- expect(() => id.isUri('wss://exa=mple')).to.throw(Error, 'Invalid URI: wss://exa=mple');
271
- });
272
-
273
- test('Invalid - = character (sub-delims) in file reg_name', () => {
274
- expect(() => id.isUri('file://exa=mple')).to.throw(Error, 'Invalid URI: file://exa=mple');
275
- });
276
-
277
- test('Valid case insensitive http scheme', () => {
278
- expect(id.isUri('httP://example')).to.equal(true);
279
- });
280
-
281
- test('Valid case insensitive https scheme', () => {
282
- expect(id.isUri('httPs://example')).to.equal(true);
283
- });
284
-
285
- test('Valid case insensitive ws scheme', () => {
286
- expect(id.isUri('WS://example')).to.equal(true);
287
- });
288
-
289
- test('Valid case insensitive wss scheme', () => {
290
- expect(id.isUri('WSs://example')).to.equal(true);
291
- });
292
-
293
- test('Valid case insensitive file scheme', () => {
294
- expect(id.isUri('fILE://example')).to.equal(true);
295
- });
296
-
297
- });
298
-
299
- describe('isIri with hostnames', () => {
300
- test('Valid character ! (sub-delims) in iri reg_name', () => {
301
- expect(id.isIri('iri://exa!mple')).to.equal(true);
302
- });
303
-
304
- test('Valid character & (sub-delims) in iri reg_name', () => {
305
- expect(id.isIri('iri://exa&mple')).to.equal(true);
306
- });
307
-
308
- test('Valid character $ (sub-delims) in iri reg_name', () => {
309
- expect(id.isIri('iri://exa$mple')).to.equal(true);
310
- });
311
-
312
- test("Valid character ' (sub-delims) in iri reg_name", () => {
313
- expect(id.isIri("iri://exa'mple")).to.equal(true);
314
- });
315
-
316
- test('Valid character ( (sub-delims) in iri reg_name', () => {
317
- expect(id.isIri('iri://exa(mple')).to.equal(true);
318
- });
319
-
320
- test('Valid character ) (sub-delims) in iri reg_name', () => {
321
- expect(id.isIri('iri://exa)mple')).to.equal(true);
322
- });
323
-
324
- test('Valid character * (sub-delims) in iri reg_name', () => {
325
- expect(id.isIri('iri://exa*mple')).to.equal(true);
326
- });
327
-
328
- test('Valid character + (sub-delims) in iri reg_name', () => {
329
- expect(id.isIri('iri://exa+mple')).to.equal(true);
330
- });
331
-
332
- test('Valid character , (sub-delims) in iri reg_name', () => {
333
- expect(id.isIri('iri://exa,mple')).to.equal(true);
334
- });
335
-
336
- test('Valid character ; (sub-delims) in iri reg_name', () => {
337
- expect(id.isIri('iri://exa;mple')).to.equal(true);
338
- });
339
-
340
- test('Valid character = (sub-delims) in iri reg_name', () => {
341
- expect(id.isIri('iri://exa=mple')).to.equal(true);
342
- });
343
-
344
- test('Valid character - (unreserved) anywhere in iri reg_name', () => {
345
- expect(id.isIri('iri://-exa-mple-')).to.equal(true);
346
- });
347
-
348
- test('Valid character . multiple times (unreserved) in iri reg_name', () => {
349
- expect(id.isIri('iri://exa..mple')).to.equal(true);
350
- });
351
-
352
- test('Valid character _ (unreserved) in iri reg_name', () => {
353
- expect(id.isIri('iri://exa_mple')).to.equal(true);
354
- });
355
-
356
- test('Valid character %20 (pct-encoded) in iri reg_name', () => {
357
- expect(id.isIri('iri://exa%20mple')).to.equal(true);
358
- });
359
-
360
- test('Invalid %GG (invalid pct-encoded) in iri reg_name', () => {
361
- expect(() => id.isIri('iri://exa%GGmple')).to.throw(Error, 'Invalid IRI: iri://exa%GGmple');
362
- });
363
-
364
- test('Valid label - alphanumeric', () => {
365
- expect(id.isIri('https://example')).to.equal(true);
366
- });
367
-
368
- test('Valid label - hyphen in middle', () => {
369
- expect(id.isIri('https://exa-mple')).to.equal(true);
370
- });
371
-
372
- test('Invalid label - hyphen at start', () => {
373
- expect(() => id.isIri('https://-example')).to.throw(Error, 'Invalid IRI: https://-example');
374
- });
375
-
376
- test('Invalid label - hyphen at end', () => {
377
- expect(() => id.isIri('https://example-')).to.throw(Error, 'Invalid IRI: https://example-');
378
- });
379
-
380
- test('Valid unicode label - Latin extended', () => {
381
- expect(id.isIri('https://exämple')).to.equal(true);
382
- });
383
-
384
- test('Valid unicode label - Chinese', () => {
385
- expect(id.isIri('https://例子')).to.equal(true);
386
- });
387
-
388
- test('Valid unicode label - Hindi', () => {
389
- expect(id.isIri('https://उदाहरण')).to.equal(true);
390
- });
391
-
392
- test('Valid unicode label - Japanese', () => {
393
- expect(id.isIri('https://例え.テスト')).to.equal(true);
394
- });
395
-
396
- test('Valid label with middle dot', () => {
397
- expect(id.isIri('https://exa·mple')).to.equal(true);
398
- });
399
-
400
- test('Invalid - leading dot', () => {
401
- expect(() => id.isIri('https://.example')).to.throw(Error, 'Invalid IRI: https://.example');
402
- });
403
-
404
- test('Invalid - trailing dot', () => {
405
- expect(() => id.isIri('https://example.')).to.throw(Error, 'Invalid IRI: https://example.');
406
- });
407
-
408
- test('Invalid - consecutive dots', () => {
409
- expect(() => id.isIri('https://example..test')).to.throw(Error, 'Invalid IRI: https://example..test');
410
- });
411
-
412
- test('Invalid - emoji in label', () => {
413
- expect(() => id.isIri('https://example😀')).to.throw(Error, 'Invalid IRI: https://example😀');
414
- });
415
-
416
- test('Invalid - % character (pct_encoded) in http(s) reg_name', () => {
417
- expect(() => id.isIri('https://exa%20mple')).to.throw(Error, 'Invalid IRI: https://exa%20mple');
418
- });
419
-
420
- test('Invalid - % character (pct_encoded) in ws(s) reg_name', () => {
421
- expect(() => id.isIri('wss://exa%20mple')).to.throw(Error, 'Invalid IRI: wss://exa%20mple');
422
- });
423
-
424
- test('Invalid - % character (pct_encoded) in file reg_name', () => {
425
- expect(() => id.isIri('file://exa%20mple')).to.throw(Error, 'Invalid IRI: file://exa%20mple');
426
- });
427
-
428
- test('Invalid - ~ character (unreserved) in http(s) reg_name', () => {
429
- expect(() => id.isIri('https://exa~mple')).to.throw(Error, 'Invalid IRI: https://exa~mple');
430
- });
431
-
432
- test('Invalid - ~ character (unreserved) in ws(s) reg_name', () => {
433
- expect(() => id.isIri('wss://exa~mple')).to.throw(Error, 'Invalid IRI: wss://exa~mple');
434
- });
435
-
436
- test('Invalid - ~ character (unreserved) in file reg_name', () => {
437
- expect(() => id.isIri('file://exa~mple')).to.throw(Error, 'Invalid IRI: file://exa~mple');
438
- });
439
-
440
- test('Invalid - _ character (unreserved) in http(s) reg_name', () => {
441
- expect(() => id.isIri('https://exa_mple')).to.throw(Error, 'Invalid IRI: https://exa_mple');
442
- });
443
-
444
- test('Invalid - _ character (unreserved) in ws(s) reg_name', () => {
445
- expect(() => id.isIri('wss://exa_mple')).to.throw(Error, 'Invalid IRI: wss://exa_mple');
446
- });
447
-
448
- test('Invalid - _ character (unreserved) in file reg_name', () => {
449
- expect(() => id.isIri('file://exa_mple')).to.throw(Error, 'Invalid IRI: file://exa_mple');
450
- });
451
-
452
- test('Invalid - ! character (sub-delims) in http(s) reg_name', () => {
453
- expect(() => id.isIri('https://exa!mple')).to.throw(Error, 'Invalid IRI: https://exa!mple');
454
- });
455
-
456
- test('Invalid - ! character (sub-delims) in ws(s) reg_name', () => {
457
- expect(() => id.isIri('wss://exa!mple')).to.throw(Error, 'Invalid IRI: wss://exa!mple');
458
- });
459
-
460
- test('Invalid - ! character (sub-delims) in file reg_name', () => {
461
- expect(() => id.isIri('file://exa!mple')).to.throw(Error, 'Invalid IRI: file://exa!mple');
462
- });
463
-
464
- test('Invalid - & character (sub-delims) in http(s) reg_name', () => {
465
- expect(() => id.isIri('https://exa&mple')).to.throw(Error, 'Invalid IRI: https://exa&mple');
466
- });
467
-
468
- test('Invalid - & character (sub-delims) in ws(s) reg_name', () => {
469
- expect(() => id.isIri('wss://exa&mple')).to.throw(Error, 'Invalid IRI: wss://exa&mple');
470
- });
471
-
472
- test('Invalid - & character (sub-delims) in file reg_name', () => {
473
- expect(() => id.isIri('file://exa&mple')).to.throw(Error, 'Invalid IRI: file://exa&mple');
474
- });
475
-
476
- test('Invalid - $ character (sub-delims) in http(s) reg_name', () => {
477
- expect(() => id.isIri('https://exa$mple')).to.throw(Error, 'Invalid IRI: https://exa$mple');
478
- });
479
-
480
- test('Invalid - $ character (sub-delims) in ws(s) reg_name', () => {
481
- expect(() => id.isIri('wss://exa$mple')).to.throw(Error, 'Invalid IRI: wss://exa$mple');
482
- });
483
-
484
- test('Invalid - $ character (sub-delims) in file reg_name', () => {
485
- expect(() => id.isIri('file://exa$mple')).to.throw(Error, 'Invalid IRI: file://exa$mple');
486
- });
487
-
488
- test("Invalid - ' character (sub-delims) in http(s) reg_name", () => {
489
- expect(() => id.isIri("https://exa'mple")).to.throw(Error, "Invalid IRI: https://exa'mple");
490
- });
491
-
492
- test("Invalid - ' character (sub-delims) in ws(s) reg_name", () => {
493
- expect(() => id.isIri("wss://exa'mple")).to.throw(Error, "Invalid IRI: wss://exa'mple");
494
- });
495
-
496
- test("Invalid - ' character (sub-delims) in file reg_name", () => {
497
- expect(() => id.isIri("file://exa'mple")).to.throw(Error, "Invalid IRI: file://exa'mple");
498
- });
499
-
500
- test('Invalid - ( character (sub-delims) in http(s) reg_name', () => {
501
- expect(() => id.isIri('https://exa(mple')).to.throw(Error, 'Invalid IRI: https://exa(mple');
502
- });
503
-
504
- test('Invalid - ( character (sub-delims) in ws(s) reg_name', () => {
505
- expect(() => id.isIri('wss://exa(mple')).to.throw(Error, 'Invalid IRI: wss://exa(mple');
506
- });
507
-
508
- test('Invalid - ( character (sub-delims) in file reg_name', () => {
509
- expect(() => id.isIri('file://exa(mple')).to.throw(Error, 'Invalid IRI: file://exa(mple');
510
- });
511
-
512
- test('Invalid - ) character (sub-delims) in http(s) reg_name', () => {
513
- expect(() => id.isIri('https://exa)mple')).to.throw(Error, 'Invalid IRI: https://exa)mple');
514
- });
515
-
516
- test('Invalid - ) character (sub-delims) in ws(s) reg_name', () => {
517
- expect(() => id.isIri('wss://exa)mple')).to.throw(Error, 'Invalid IRI: wss://exa)mple');
518
- });
519
-
520
- test('Invalid - ) character (sub-delims) in file reg_name', () => {
521
- expect(() => id.isIri('file://exa)mple')).to.throw(Error, 'Invalid IRI: file://exa)mple');
522
- });
523
-
524
- test('Invalid - * character (sub-delims) in http(s) reg_name', () => {
525
- expect(() => id.isIri('https://exa*mple')).to.throw(Error, 'Invalid IRI: https://exa*mple');
526
- });
527
-
528
- test('Invalid - * character (sub-delims) in ws(s) reg_name', () => {
529
- expect(() => id.isIri('wss://exa*mple')).to.throw(Error, 'Invalid IRI: wss://exa*mple');
530
- });
531
-
532
- test('Invalid - * character (sub-delims) in file reg_name', () => {
533
- expect(() => id.isIri('file://exa*mple')).to.throw(Error, 'Invalid IRI: file://exa*mple');
534
- });
535
-
536
- test('Invalid - + character (sub-delims) in http(s) reg_name', () => {
537
- expect(() => id.isIri('https://exa+mple')).to.throw(Error, 'Invalid IRI: https://exa+mple');
538
- });
539
-
540
- test('Invalid - + character (sub-delims) in ws(s) reg_name', () => {
541
- expect(() => id.isIri('wss://exa+mple')).to.throw(Error, 'Invalid IRI: wss://exa+mple');
542
- });
543
-
544
- test('Invalid - + character (sub-delims) in file reg_name', () => {
545
- expect(() => id.isIri('file://exa+mple')).to.throw(Error, 'Invalid IRI: file://exa+mple');
546
- });
547
-
548
- test('Invalid - , character (sub-delims) in http(s) reg_name', () => {
549
- expect(() => id.isIri('https://exa,mple')).to.throw(Error, 'Invalid IRI: https://exa,mple');
550
- });
551
-
552
- test('Invalid - , character (sub-delims) in ws(s) reg_name', () => {
553
- expect(() => id.isIri('wss://exa,mple')).to.throw(Error, 'Invalid IRI: wss://exa,mple');
554
- });
555
-
556
- test('Invalid - , character (sub-delims) in file reg_name', () => {
557
- expect(() => id.isIri('file://exa,mple')).to.throw(Error, 'Invalid IRI: file://exa,mple');
558
- });
559
-
560
- test('Invalid - ; character (sub-delims) in http(s) reg_name', () => {
561
- expect(() => id.isIri('https://exa;mple')).to.throw(Error, 'Invalid IRI: https://exa;mple');
562
- });
563
-
564
- test('Invalid - ; character (sub-delims) in ws(s) reg_name', () => {
565
- expect(() => id.isIri('wss://exa;mple')).to.throw(Error, 'Invalid IRI: wss://exa;mple');
566
- });
567
-
568
- test('Invalid - ; character (sub-delims) in file reg_name', () => {
569
- expect(() => id.isIri('file://exa;mple')).to.throw(Error, 'Invalid IRI: file://exa;mple');
570
- });
571
-
572
- test('Invalid - = character (sub-delims) in http(s) reg_name', () => {
573
- expect(() => id.isIri('https://exa=mple')).to.throw(Error, 'Invalid IRI: https://exa=mple');
574
- });
575
-
576
- test('Invalid - = character (sub-delims) in ws(s) reg_name', () => {
577
- expect(() => id.isIri('wss://exa=mple')).to.throw(Error, 'Invalid IRI: wss://exa=mple');
578
- });
579
-
580
- test('Invalid - = character (sub-delims) in file reg_name', () => {
581
- expect(() => id.isIri('file://exa=mple')).to.throw(Error, 'Invalid IRI: file://exa=mple');
582
- });
583
-
584
- test('Valid case insensitive http scheme', () => {
585
- expect(id.isIri('httP://example')).to.equal(true);
586
- });
587
-
588
- test('Valid case insensitive https scheme', () => {
589
- expect(id.isIri('httPs://example')).to.equal(true);
590
- });
591
-
592
- test('Valid case insensitive ws scheme', () => {
593
- expect(id.isIri('WS://example')).to.equal(true);
594
- });
595
-
596
- test('Valid case insensitive wss scheme', () => {
597
- expect(id.isIri('WSs://example')).to.equal(true);
598
- });
599
-
600
- test('Valid case insensitive file scheme', () => {
601
- expect(id.isIri('fILE://example')).to.equal(true);
602
- });
603
-
604
- });