Skip to content

Commit a4b2363

Browse files
Fix coverage
1 parent 3f11a9e commit a4b2363

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/snaps-utils/src/base64.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ describe('encodeBase64', () => {
5151
);
5252
expect(await encodeBase64(vfile)).toBe('eyJmb28iOiJiYXIifQ==');
5353
});
54+
55+
it('does not use optimization when running in React Native', async () => {
56+
Object.defineProperty(globalThis, 'FileReader', {
57+
value: MockFileReader,
58+
});
59+
60+
Object.defineProperty(globalThis, 'navigator', {
61+
value: { product: 'ReactNative' },
62+
});
63+
64+
const vfile = new VirtualFile(
65+
stringToBytes(JSON.stringify({ foo: 'bar' })),
66+
);
67+
expect(await encodeBase64(vfile)).toBe('eyJmb28iOiJiYXIifQ==');
68+
});
5469
});
5570

5671
describe('decodeBase64', () => {

0 commit comments

Comments
 (0)