Skip to content

Commit

Permalink
* add shim test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethella committed Apr 16, 2022
1 parent 5ac1170 commit 82c65d4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/spec/utils/shim.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import atob from 'atob';

test('#01: Shim overwrites undefined global atob', async () => {
globalThis.atob = undefined;

expect(globalThis.atob).toBeUndefined();

// eslint-disable-next-line global-require
require('../../../src/utils/shim');

expect(globalThis.atob).toBe(atob);
});

test('#02: Shim does not overwrite exisiting atob', async () => {
const dummyFunc = () => '';
globalThis.atob = dummyFunc;

expect(globalThis.atob).toBe(dummyFunc);

// eslint-disable-next-line global-require
require('../../../src/utils/shim');

expect(globalThis.atob).toBe(dummyFunc);
});

0 comments on commit 82c65d4

Please sign in to comment.