tests: enable nock when needed
by default, it makes all requests disappear
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user