Skip to content

Commit ac738c3

Browse files
committed
test: detect globalThis instead
1 parent 7264ed5 commit ac738c3

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
name="viewport"
1111
content="width=device-width, initial-scale=1.0"
1212
/>
13-
<title>Vitery</title>
13+
<title>ab64</title>
1414
</head>
1515
<body>
1616
<div id="app"></div>

test/ponyfill.spec.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { atob, btoa } from 'ab64/ponyfill'
22

3-
const MIN = 16
4-
5-
test.skipIf(+process.versions.node < MIN)(
6-
'it should work same as the builtin',
7-
() => {
8-
expect(atob('SGVsbG8gV29ybGQh')).toBe(globalThis.atob('SGVsbG8gV29ybGQh'))
9-
expect(btoa('Hello World!')).toBe(globalThis.btoa('Hello World!'))
10-
},
11-
)
3+
test.runIf(
4+
typeof globalThis.atob === 'function' &&
5+
typeof globalThis.btoa === 'function',
6+
)('it should work same as the builtin', () => {
7+
expect(atob('SGVsbG8gV29ybGQh')).toBe(globalThis.atob('SGVsbG8gV29ybGQh'))
8+
expect(btoa('Hello World!')).toBe(globalThis.btoa('Hello World!'))
9+
})

0 commit comments

Comments
 (0)