GeezerVison is showing github.com — fix: missing v7 expectations in browser spec (#751) · uuidjs/uuid@f54a866
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: examples/browser-rollup/package-lock.json +7-3Lines changed: 7 additions & 3 deletions Collapse file
Copy file name to clipboardExpand all lines: examples/browser-webpack/package-lock.json +7-3Lines changed: 7 additions & 3 deletions Collapse file
Copy file name to clipboardExpand all lines: test/browser/browser.spec.js +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
2 | 2 |
|
3 | 3 | const v1Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i; |
4 | 4 | const v4Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i; |
| 5 | +const v7Regex = /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i; |
5 | 6 |
|
6 | 7 | const v1 = (result) => expect(result).toMatch(v1Regex); |
7 | 8 | const v4 = (result) => expect(result).toMatch(v4Regex); |
| 9 | +const v7 = (result) => expect(result).toMatch(v7Regex); |
8 | 10 | const v3dns = (result) => expect(result).toBe('9125a8dc-52ee-365b-a5aa-81b0b3681cf6'); |
9 | 11 | const v3url = (result) => expect(result).toBe('c6235813-3ba4-3801-ae84-e0a6ebb7d138'); |
10 | 12 | const v3custom = (result) => expect(result).toBe('f5a52d34-dcd7-30f7-b581-0112fab43d0c'); |
@@ -22,6 +24,7 @@ const version = (result) => expect(result).toBe('4'); |
22 | 24 | const expectations = { |
23 | 25 | 'uuidv1()': v1, |
24 | 26 | 'uuidv4()': v4, |
| 27 | + 'uuidv7()': v7, |
25 | 28 | 'uuidv3() DNS': v3dns, |
26 | 29 | 'uuidv3() URL': v3url, |
27 | 30 | 'uuidv3() MY_NAMESPACE': v3custom, |
@@ -37,6 +40,7 @@ const expectations = { |
37 | 40 |
|
38 | 41 | 'uuid.v1()': v1, |
39 | 42 | 'uuid.v4()': v4, |
| 43 | + 'uuid.v7()': v7, |
40 | 44 | 'uuid.v3() DNS': v3dns, |
41 | 45 | 'uuid.v3() URL': v3url, |
42 | 46 | 'uuid.v3() MY_NAMESPACE': v3custom, |
@@ -75,6 +79,8 @@ describe('BrowserStack Local Testing', () => { |
75 | 79 | const resultEl = await element.$('dd'); |
76 | 80 | const result = await resultEl.getText(); |
77 | 81 |
|
| 82 | + if (!expectations[title]) throw new Error(`Unexpected title: ${title}`); |
| 83 | + |
78 | 84 | expectations[title](result); |
79 | 85 | titles.push(title); |
80 | 86 | } |
|