Skip to content

Commit 82c65d4

Browse files
committed
* add shim test
1 parent 5ac1170 commit 82c65d4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/spec/utils/shim.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import atob from 'atob';
2+
3+
test('#01: Shim overwrites undefined global atob', async () => {
4+
globalThis.atob = undefined;
5+
6+
expect(globalThis.atob).toBeUndefined();
7+
8+
// eslint-disable-next-line global-require
9+
require('../../../src/utils/shim');
10+
11+
expect(globalThis.atob).toBe(atob);
12+
});
13+
14+
test('#02: Shim does not overwrite exisiting atob', async () => {
15+
const dummyFunc = () => '';
16+
globalThis.atob = dummyFunc;
17+
18+
expect(globalThis.atob).toBe(dummyFunc);
19+
20+
// eslint-disable-next-line global-require
21+
require('../../../src/utils/shim');
22+
23+
expect(globalThis.atob).toBe(dummyFunc);
24+
});

0 commit comments

Comments
 (0)