Increase database test timeout to 10 seconds

Setting up the database is slow.
This commit is contained in:
Roy Paterson 2023-11-20 16:49:05 +00:00
parent e39474bc23
commit 0070aa7ee7
2 changed files with 21 additions and 15 deletions

View File

@ -145,19 +145,22 @@ describe('ProjectMiddleware', () => {
let database!: Database;
beforeEach(async () => {
jest.clearAllMocks();
next = jest.fn();
database = new Database();
await database.createAndConnect();
beforeEach(
async () => {
jest.clearAllMocks();
next = jest.fn();
database = new Database();
await database.createAndConnect();
if (req.headers === undefined) {
req.headers = {};
}
if (req.headers === undefined) {
req.headers = {};
}
req.headers['tenantid'] = mockedObjectId.toString();
req.headers['apikey'] = mockedObjectId.toString();
});
req.headers['tenantid'] = mockedObjectId.toString();
req.headers['apikey'] = mockedObjectId.toString();
},
10 * 1000 // 10 second timeout because setting up the DB is slow
);
afterEach(async () => {
await database.disconnectAndDropDatabase();

View File

@ -12,10 +12,13 @@ import { fail } from 'assert';
describe('probeService', () => {
let database!: Database;
beforeEach(async () => {
database = new Database();
await database.createAndConnect();
});
beforeEach(
async () => {
database = new Database();
await database.createAndConnect();
},
10 * 1000 // 10 second timeout because setting up the DB is slow
);
afterEach(async () => {
await database.disconnectAndDropDatabase();