tests: enable nock when needed

by default, it makes all requests disappear
This commit is contained in:
Girish Ramakrishnan
2025-02-05 18:19:00 +01:00
parent 7bcb6dd7cb
commit aa54e47029
6 changed files with 8 additions and 0 deletions
+1
View File
@@ -19,6 +19,7 @@ describe('Appstore', function () {
const { setup, cleanup, appstoreToken, mockApiServerOrigin } = common;
before(setup);
before(() => { if (!nock.isActive()) nock.activate(); });
after(cleanup);
beforeEach(nock.cleanAll);
+3
View File
@@ -212,6 +212,7 @@ function createTree(root, obj) {
}
async function databaseSetup() {
if (nock.isActive()) nock.restore();
nock.cleanAll();
await database.initialize();
@@ -221,6 +222,7 @@ async function databaseSetup() {
}
async function domainSetup() {
if (nock.isActive()) nock.restore();
nock.cleanAll();
await databaseSetup();
@@ -242,6 +244,7 @@ async function setup() {
}
async function cleanup() {
if (nock.isActive()) nock.restore();
nock.cleanAll();
mailer._mailQueue = [];
+1
View File
@@ -21,6 +21,7 @@ describe('dns provider', function () {
const domainCopy = Object.assign({}, domain); // make a copy
before(setup);
before(() => { if (!nock.isActive()) nock.activate(); });
after(cleanup);
describe('noop', function () {
+1
View File
@@ -21,6 +21,7 @@ describe('updatechecker', function () {
const { setup, cleanup, app, appstoreToken, mockApiServerOrigin } = common;
before(setup);
before(() => { if (!nock.isActive()) nock.activate(); });
after(cleanup);
describe('box', function () {