From 2ea6431bf236439d0001cd8cc397c1343005011f Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Wed, 1 Nov 2023 16:33:28 +0100 Subject: [PATCH] Fix a testing issue and update coverage --- packages/snaps-execution-environments/coverage.json | 8 ++++---- .../src/common/endowments/network.test.ts | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/snaps-execution-environments/coverage.json b/packages/snaps-execution-environments/coverage.json index 94a72528a9..ffc65a262d 100644 --- a/packages/snaps-execution-environments/coverage.json +++ b/packages/snaps-execution-environments/coverage.json @@ -1,6 +1,6 @@ { - "branches": 81.29, - "functions": 92.59, - "lines": 92.03, - "statements": 91.71 + "branches": 80.85, + "functions": 92.7, + "lines": 91.95, + "statements": 91.65 } diff --git a/packages/snaps-execution-environments/src/common/endowments/network.test.ts b/packages/snaps-execution-environments/src/common/endowments/network.test.ts index 05bca04ef6..1b19aa67a3 100644 --- a/packages/snaps-execution-environments/src/common/endowments/network.test.ts +++ b/packages/snaps-execution-environments/src/common/endowments/network.test.ts @@ -12,7 +12,6 @@ describe('Network endowments', () => { describe('fetch', () => { beforeEach(() => { fetchMock.enableMocks(); - factoryOptions.notify.mockClear(); }); afterEach(() => { @@ -28,18 +27,19 @@ describe('Network endowments', () => { }); it('send notification about outbound request and response', async () => { + const notify = jest.fn(); const RESULT = 'OK'; fetchMock.mockOnce(async () => Promise.resolve(RESULT)); - const { fetch } = network.factory(factoryOptions); + const { fetch } = network.factory({ notify }); const result = await (await fetch('foo.com')).text(); expect(result).toStrictEqual(RESULT); - expect(factoryOptions.notify).toHaveBeenCalledWith({ + expect(notify).toHaveBeenCalledWith({ method: 'OutboundRequest', }); - expect(factoryOptions.notify).toHaveBeenCalledWith({ + expect(notify).toHaveBeenCalledWith({ method: 'OutboundResponse', }); - expect(factoryOptions.notify).toHaveBeenCalledTimes(4); + expect(notify).toHaveBeenCalledTimes(4); }); it('can use AbortController normally', async () => {