diff --git a/packages/snaps-controllers/coverage.json b/packages/snaps-controllers/coverage.json index 28873f6536..0ef4e9b911 100644 --- a/packages/snaps-controllers/coverage.json +++ b/packages/snaps-controllers/coverage.json @@ -1,6 +1,6 @@ { - "branches": 92.89, + "branches": 92.91, "functions": 96.71, - "lines": 98, + "lines": 98.01, "statements": 97.71 } diff --git a/packages/snaps-controllers/src/test-utils/webview.ts b/packages/snaps-controllers/src/test-utils/webview.ts index 4838f57c95..2e9d1a9fe1 100644 --- a/packages/snaps-controllers/src/test-utils/webview.ts +++ b/packages/snaps-controllers/src/test-utils/webview.ts @@ -1,4 +1,9 @@ -import { base64ToBytes, bytesToString } from '@metamask/utils'; +import { + base64ToBytes, + bytesToBase64, + bytesToString, + stringToBytes, +} from '@metamask/utils'; import { WebViewMessageStream } from '../services/webview/WebViewMessageStream'; @@ -52,6 +57,11 @@ export function createWebViewObjects() { name: 'a', target: 'b', getWebView: mockGetWebViewA, + // For one of the streams, we test that a custom btoa function is used. + btoa: (data: string) => { + const bytes = stringToBytes(data); + return bytesToBase64(bytes); + }, }); const streamB = new WebViewMessageStream({