Skip to content

Commit 9005464

Browse files
Fix tests and re-order fetch notification
1 parent b92caee commit 9005464

File tree

4 files changed

+10
-40
lines changed

4 files changed

+10
-40
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"branches": 93.51,
2+
"branches": 93.09,
33
"functions": 97.36,
4-
"lines": 98.33,
5-
"statements": 98.17
4+
"lines": 98.19,
5+
"statements": 98.03
66
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"branches": 90,
2+
"branches": 89.89,
33
"functions": 94.57,
4-
"lines": 90.14,
5-
"statements": 89.51
4+
"lines": 89.88,
5+
"statements": 89.24
66
}

packages/snaps-execution-environments/src/common/BaseSnapExecutor.test.browser.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,6 @@ describe('BaseSnapExecutor', () => {
264264
},
265265
});
266266

267-
expect(await executor.readCommand()).toStrictEqual({
268-
jsonrpc: '2.0',
269-
method: 'OutboundResponse',
270-
params: { source: 'snap.request' },
271-
});
272-
273267
expect(await executor.readCommand()).toStrictEqual({
274268
id: 2,
275269
jsonrpc: '2.0',
@@ -407,12 +401,6 @@ describe('BaseSnapExecutor', () => {
407401
],
408402
});
409403

410-
expect(await executor.readCommand()).toStrictEqual({
411-
jsonrpc: '2.0',
412-
method: 'OutboundRequest',
413-
params: { source: 'snap.request' },
414-
});
415-
416404
const getSnapsRequest = await executor.readRpc();
417405
expect(getSnapsRequest).toStrictEqual({
418406
name: 'metamask-provider',
@@ -441,12 +429,6 @@ describe('BaseSnapExecutor', () => {
441429
},
442430
});
443431

444-
expect(await executor.readCommand()).toStrictEqual({
445-
jsonrpc: '2.0',
446-
method: 'OutboundResponse',
447-
params: { source: 'snap.request' },
448-
});
449-
450432
expect(await executor.readCommand()).toStrictEqual({
451433
id: 2,
452434
jsonrpc: '2.0',
@@ -778,12 +760,6 @@ describe('BaseSnapExecutor', () => {
778760
],
779761
});
780762

781-
expect(await executor.readCommand()).toStrictEqual({
782-
jsonrpc: '2.0',
783-
method: 'OutboundRequest',
784-
params: { source: 'snap.request' },
785-
});
786-
787763
const request = await executor.readRpc();
788764
expect(request).toStrictEqual({
789765
name: 'metamask-provider',
@@ -811,12 +787,6 @@ describe('BaseSnapExecutor', () => {
811787
},
812788
});
813789

814-
expect(await executor.readCommand()).toStrictEqual({
815-
jsonrpc: '2.0',
816-
method: 'OutboundResponse',
817-
params: { source: 'snap.request' },
818-
});
819-
820790
expect(await executor.readCommand()).toStrictEqual({
821791
id: 2,
822792
jsonrpc: '2.0',

packages/snaps-execution-environments/src/common/endowments/network.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,14 @@ const createNetwork = ({ notify }: EndowmentFactoryOptions = {}) => {
226226
return await withTeardown(
227227
(async () => {
228228
try {
229-
await notify({
230-
method: 'OutboundRequest',
231-
params: { source: 'fetch' },
232-
});
233229
const fetchPromise = fetch(input, {
234230
...init,
235231
signal: abortController.signal,
236232
});
233+
await notify({
234+
method: 'OutboundRequest',
235+
params: { source: 'fetch' },
236+
});
237237

238238
openFetchConnection = {
239239
cancel: async () => {

0 commit comments

Comments
 (0)