Skip to content

Commit

Permalink
Fix a testing issue and update coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Nov 2, 2023
1 parent 009cb2a commit 2ea6431
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/snaps-execution-environments/coverage.json
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe('Network endowments', () => {
describe('fetch', () => {
beforeEach(() => {
fetchMock.enableMocks();
factoryOptions.notify.mockClear();
});

afterEach(() => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 2ea6431

Please sign in to comment.