Skip to content

Commit 98cb605

Browse files
authored
Don't stub crypto if it's available (#5)
* 1.0.9 * Stub crypto only if it's not globally available
1 parent c68641c commit 98cb605

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@managed-components/google-analytics",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {

src/requestBuilder.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { getToolRequest } from './requestBuilder'
33

44
const isInt = (num: string) => !isNaN(parseInt(num))
55

6-
vi.stubGlobal('crypto', {
7-
randomUUID: () => {
8-
return '2006998272.1617012296'
9-
},
10-
})
6+
if (!global.crypto) {
7+
vi.stubGlobal('crypto', {
8+
randomUUID: () => {
9+
return '2006998272.1617012296'
10+
},
11+
})
12+
}
1113

1214
describe('getToolRequest', () => {
1315
const mockEvent = new Event('pageview') as MCEvent

0 commit comments

Comments
 (0)