source: imaps-frontend/node_modules/uuid/dist/esm-browser/test/test_constants.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 6.0 KB
RevLine 
[79a0317]1import MAX from '../max.js';
2import NIL from '../nil.js';
3export const TESTS = [
4 { value: NIL, expectedValidate: true, expectedVersion: 0 },
5 { value: MAX, expectedValidate: true, expectedVersion: 15 },
6 { value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },
7 { value: 'ffffffff-ffff-1fff-8fff-ffffffffffff', expectedValidate: true, expectedVersion: 1 },
8 { value: '00000000-0000-2000-8000-000000000000', expectedValidate: true, expectedVersion: 2 },
9 { value: 'ffffffff-ffff-2fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 2 },
10 { value: '00000000-0000-3000-8000-000000000000', expectedValidate: true, expectedVersion: 3 },
11 { value: 'ffffffff-ffff-3fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 3 },
12 { value: '00000000-0000-4000-8000-000000000000', expectedValidate: true, expectedVersion: 4 },
13 { value: 'ffffffff-ffff-4fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 4 },
14 { value: '00000000-0000-5000-8000-000000000000', expectedValidate: true, expectedVersion: 5 },
15 { value: 'ffffffff-ffff-5fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 5 },
16 { value: '00000000-0000-6000-8000-000000000000', expectedValidate: true, expectedVersion: 6 },
17 { value: 'ffffffff-ffff-6fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 6 },
18 { value: '00000000-0000-7000-8000-000000000000', expectedValidate: true, expectedVersion: 7 },
19 { value: 'ffffffff-ffff-7fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 7 },
20 { value: '00000000-0000-8000-8000-000000000000', expectedValidate: true, expectedVersion: 8 },
21 { value: 'ffffffff-ffff-8fff-bfff-ffffffffffff', expectedValidate: true, expectedVersion: 8 },
22 { value: '00000000-0000-9000-8000-000000000000', expectedValidate: false },
23 { value: 'ffffffff-ffff-9fff-bfff-ffffffffffff', expectedValidate: false },
24 { value: '00000000-0000-a000-8000-000000000000', expectedValidate: false },
25 { value: 'ffffffff-ffff-afff-bfff-ffffffffffff', expectedValidate: false },
26 { value: '00000000-0000-b000-8000-000000000000', expectedValidate: false },
27 { value: 'ffffffff-ffff-bfff-bfff-ffffffffffff', expectedValidate: false },
28 { value: '00000000-0000-c000-8000-000000000000', expectedValidate: false },
29 { value: 'ffffffff-ffff-cfff-bfff-ffffffffffff', expectedValidate: false },
30 { value: '00000000-0000-d000-8000-000000000000', expectedValidate: false },
31 { value: 'ffffffff-ffff-dfff-bfff-ffffffffffff', expectedValidate: false },
32 { value: '00000000-0000-e000-8000-000000000000', expectedValidate: false },
33 { value: 'ffffffff-ffff-efff-bfff-ffffffffffff', expectedValidate: false },
34 { value: 'd9428888-122b-11e1-b85c-61cd3cbb3210', expectedValidate: true, expectedVersion: 1 },
35 { value: '000003e8-2363-21ef-b200-325096b39f47', expectedValidate: true, expectedVersion: 2 },
36 { value: 'a981a0c2-68b1-35dc-bcfc-296e52ab01ec', expectedValidate: true, expectedVersion: 3 },
37 { value: '109156be-c4fb-41ea-b1b4-efe1671c5836', expectedValidate: true, expectedVersion: 4 },
38 { value: '90123e1c-7512-523e-bb28-76fab9f2f73d', expectedValidate: true, expectedVersion: 5 },
39 { value: '1ef21d2f-1207-6660-8c4f-419efbd44d48', expectedValidate: true, expectedVersion: 6 },
40 { value: '017f22e2-79b0-7cc3-98c4-dc0c0c07398f', expectedValidate: true, expectedVersion: 7 },
41 { value: '0d8f23a0-697f-83ae-802e-48f3756dd581', expectedValidate: true, expectedVersion: 8 },
42 { value: '00000000-0000-1000-0000-000000000000', expectedValidate: false },
43 { value: '00000000-0000-1000-1000-000000000000', expectedValidate: false },
44 { value: '00000000-0000-1000-2000-000000000000', expectedValidate: false },
45 { value: '00000000-0000-1000-3000-000000000000', expectedValidate: false },
46 { value: '00000000-0000-1000-4000-000000000000', expectedValidate: false },
47 { value: '00000000-0000-1000-5000-000000000000', expectedValidate: false },
48 { value: '00000000-0000-1000-6000-000000000000', expectedValidate: false },
49 { value: '00000000-0000-1000-7000-000000000000', expectedValidate: false },
50 { value: '00000000-0000-1000-8000-000000000000', expectedValidate: true, expectedVersion: 1 },
51 { value: '00000000-0000-1000-9000-000000000000', expectedValidate: true, expectedVersion: 1 },
52 { value: '00000000-0000-1000-a000-000000000000', expectedValidate: true, expectedVersion: 1 },
53 { value: '00000000-0000-1000-b000-000000000000', expectedValidate: true, expectedVersion: 1 },
54 { value: '00000000-0000-1000-c000-000000000000', expectedValidate: false },
55 { value: '00000000-0000-1000-d000-000000000000', expectedValidate: false },
56 { value: '00000000-0000-1000-e000-000000000000', expectedValidate: false },
57 { value: '00000000-0000-1000-f000-000000000000', expectedValidate: false },
58 { value: '00000000000000000000000000000000', expectedValidate: false },
59 { value: '', expectedValidate: false },
60 { value: 'invalid uuid string', expectedValidate: false },
61 {
62 value: '=Y00a-f*vb*-c-d#-p00f\b-g0h-#i^-j*3&-L00k-\nl---00n-fg000-00p-00r+',
63 expectedValidate: false,
64 },
65 { value: undefined, expectedValidate: false },
66 { value: null, expectedValidate: false },
67 { value: 123, expectedValidate: false },
68 { value: /regex/, expectedValidate: false },
69 { value: new Date(0), expectedValidate: false },
70 { value: false, expectedValidate: false },
71];
72for (let charIndex = 0; charIndex < 36; charIndex++) {
73 if (charIndex === 8 ||
74 charIndex === 13 ||
75 charIndex === 14 ||
76 charIndex === 18 ||
77 charIndex === 23) {
78 continue;
79 }
80 const nilChars = NIL.split('');
81 const maxChars = MAX.split('');
82 for (let i = 0; i < 4; i++) {
83 nilChars[charIndex] = (0x0 ^ (1 << i)).toString(16);
84 TESTS.push({ value: nilChars.join(''), expectedValidate: false });
85 maxChars[charIndex] = (0xf ^ (1 << i)).toString(16);
86 TESTS.push({ value: maxChars.join(''), expectedValidate: false });
87 }
88}
Note: See TracBrowser for help on using the repository browser.