Skip to content

Commit

Permalink
fix: missing v7 expectations in browser spec (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa authored Jun 3, 2024
1 parent db76a12 commit f54a866
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 7 additions & 3 deletions examples/browser-rollup/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions examples/browser-webpack/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions test/browser/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

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;
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;
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;

const v1 = (result) => expect(result).toMatch(v1Regex);
const v4 = (result) => expect(result).toMatch(v4Regex);
const v7 = (result) => expect(result).toMatch(v7Regex);
const v3dns = (result) => expect(result).toBe('9125a8dc-52ee-365b-a5aa-81b0b3681cf6');
const v3url = (result) => expect(result).toBe('c6235813-3ba4-3801-ae84-e0a6ebb7d138');
const v3custom = (result) => expect(result).toBe('f5a52d34-dcd7-30f7-b581-0112fab43d0c');
Expand All @@ -22,6 +24,7 @@ const version = (result) => expect(result).toBe('4');
const expectations = {
'uuidv1()': v1,
'uuidv4()': v4,
'uuidv7()': v7,
'uuidv3() DNS': v3dns,
'uuidv3() URL': v3url,
'uuidv3() MY_NAMESPACE': v3custom,
Expand All @@ -37,6 +40,7 @@ const expectations = {

'uuid.v1()': v1,
'uuid.v4()': v4,
'uuid.v7()': v7,
'uuid.v3() DNS': v3dns,
'uuid.v3() URL': v3url,
'uuid.v3() MY_NAMESPACE': v3custom,
Expand Down Expand Up @@ -75,6 +79,8 @@ describe('BrowserStack Local Testing', () => {
const resultEl = await element.$('dd');
const result = await resultEl.getText();

if (!expectations[title]) throw new Error(`Unexpected title: ${title}`);

expectations[title](result);
titles.push(title);
}
Expand Down

0 comments on commit f54a866

Please sign in to comment.