Skip to content

Commit 2c1fd63

Browse files
Fix type issues
1 parent e34a722 commit 2c1fd63

2 files changed

Lines changed: 2 additions & 68 deletions

File tree

app/core/BackgroundBridge/createDupeReqFilterStream.test.ts

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// eslint-disable-next-line import/no-nodejs-modules
2-
import NodeStream from 'node:stream';
3-
import ReadableStream, { Transform } from 'readable-stream';
1+
import { Transform } from 'readable-stream';
42

53
import type { JsonRpcNotification, JsonRpcRequest } from '@metamask/utils';
64
import createDupeReqFilterStream, {
@@ -323,69 +321,4 @@ describe('createDupeReqFilterStream', () => {
323321

324322
expect(output).toEqual(expectedOutputBeforeExpiryTime);
325323
});
326-
327-
[
328-
['node:stream', NodeStream] as [string, typeof NodeStream],
329-
// Redundantly include used version twice for regression-detection purposes
330-
['readable-stream', ReadableStream] as [string, typeof ReadableStream],
331-
].forEach(([name, streamsImpl]) => {
332-
describe(`Using Streams implementation: ${name}`, () => {
333-
[
334-
['Duplex', streamsImpl.Duplex] as [string, typeof streamsImpl.Duplex],
335-
['Transform', streamsImpl.Transform] as [
336-
string,
337-
typeof streamsImpl.Transform,
338-
],
339-
['Writable', streamsImpl.Writable] as [
340-
string,
341-
typeof streamsImpl.Writable,
342-
],
343-
].forEach(([className, S]) => {
344-
it(`handles a mix of request types coming through a ${className} stream`, async () => {
345-
const requests = [
346-
{ id: 1, method: 'foo' },
347-
{ method: 'notify1' },
348-
{ id: 1, method: 'foo' },
349-
{ id: 2, method: 'bar' },
350-
{ method: 'notify2' },
351-
{ id: 2, method: 'bar' },
352-
{ id: 3, method: 'baz' },
353-
];
354-
355-
const expectedOutput = [
356-
{ id: 1, method: 'foo' },
357-
{ method: 'notify1' },
358-
{ id: 2, method: 'bar' },
359-
{ method: 'notify2' },
360-
{ id: 3, method: 'baz' },
361-
];
362-
363-
const output: JsonRpcRequest[] = [];
364-
const testStream = createDupeReqFilterStream();
365-
const testOutStream = new S({
366-
transform: (chunk: JsonRpcRequest, _, cb) => {
367-
output.push(chunk);
368-
cb();
369-
},
370-
objectMode: true,
371-
});
372-
373-
testOutStream._write = (
374-
chunk: JsonRpcRequest,
375-
_: BufferEncoding,
376-
callback: (error?: Error | null) => void,
377-
) => {
378-
output.push(chunk);
379-
callback();
380-
};
381-
382-
testStream.pipe(testOutStream);
383-
384-
requests.forEach((request) => testStream.write(request));
385-
386-
expect(output).toEqual(expectedOutput);
387-
});
388-
});
389-
});
390-
});
391324
});

app/core/Engine/controllers/snaps/execution-service-init.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const executionServiceInit: ControllerInitFunction<
6565
return {
6666
controller: new WebViewExecutionService({
6767
messenger: controllerMessenger,
68+
// @ts-expect-error The stream type doesn't match because of a version mismatch.
6869
setupSnapProvider,
6970
createWebView,
7071
removeWebView,

0 commit comments

Comments
 (0)