Skip to content

Commit

Permalink
Remove Nock hack.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimm committed Nov 16, 2021
1 parent 2e788ac commit 525ff47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
6 changes: 1 addition & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ const projects = [

// Only execute the Nockful tests on Node.js 8+.
if (parseInt(process.version.substring(1)) >= 8) {
projects.push(createProject('nockful tests', `/tests/(?:${nockfulTests.join('|')}).*/.+\\.test\\.[jt]s$`, {
// Use this custom runner. It's a normal runner, but by specifying a custom runner, it won't be shared with the
// other project.
runner: './tests/runner.js',
}));
projects.push(createProject('nockful tests', `/tests/(?:${nockfulTests.join('|')}).*/.+\\.test\\.[jt]s$`));
}

module.exports = {
Expand Down
9 changes: 8 additions & 1 deletion tests/iteration/iteration.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import createMollieClient, { ApiMode, MollieClient, Payment, PaymentMethod } from '../..';
import axios from 'axios';
import nock from 'nock';
import { setupRecorder } from 'nock-record';
import { run } from 'ruply';
import getAccessToken from '../getAccessToken';
Expand All @@ -12,6 +13,9 @@ describe('iteration', () => {
let profileId: string;

beforeAll(async () => {
if (nock.isActive() === false) {
nock.activate();
}
let accessToken: string;
({ accessToken, completeRecording } = await run(mockNetwork, async mockNetwork => {
if (mockNetwork == false) {
Expand Down Expand Up @@ -122,5 +126,8 @@ describe('iteration', () => {
expect(await iterator.next()).toEqual({ done: true, value: undefined });
});

afterAll(() => completeRecording());
afterAll(() => {
completeRecording();
nock.restore();
});
});
8 changes: 0 additions & 8 deletions tests/runner.js

This file was deleted.

0 comments on commit 525ff47

Please sign in to comment.