Skip to content

Commit c007855

Browse files
Add test
1 parent a17d7de commit c007855

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"branches": 92.89,
2+
"branches": 92.91,
33
"functions": 96.71,
4-
"lines": 98,
4+
"lines": 98.01,
55
"statements": 97.71
66
}

packages/snaps-controllers/src/test-utils/webview.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { base64ToBytes, bytesToString } from '@metamask/utils';
1+
import {
2+
base64ToBytes,
3+
bytesToBase64,
4+
bytesToString,
5+
stringToBytes,
6+
} from '@metamask/utils';
27

38
import { WebViewMessageStream } from '../services/webview/WebViewMessageStream';
49

@@ -52,6 +57,11 @@ export function createWebViewObjects() {
5257
name: 'a',
5358
target: 'b',
5459
getWebView: mockGetWebViewA,
60+
// For one of the streams, we test that a custom btoa function is used.
61+
btoa: (data: string) => {
62+
const bytes = stringToBytes(data);
63+
return bytesToBase64(bytes);
64+
},
5565
});
5666

5767
const streamB = new WebViewMessageStream({

0 commit comments

Comments
 (0)