Skip to content

Commit

Permalink
chore: Update MongoDB test database configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Junjiequan committed Jul 24, 2024
1 parent f705241 commit ec6a292
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/config/pretest.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
/* eslint-disable @typescript-eslint/no-var-requires */
//NOTE: Here we load and initialize some global variables that are used throughout the tests

require("dotenv").config();
var chaiHttp = require("chai-http");

const { MongoClient } = require("mongodb");
const testDbName = "scicat-test-db";
const uri = `mongodb://localhost:27017/${testDbName}`;

const client = new MongoClient(uri);
const client = new MongoClient(process.env.MONGODB_URI);

async function loadChai() {
const { chai } = import("chai");
chai.use(chaiHttp);
await client.connect();
}
loadChai();

loadChai();
global.appUrl = "http://localhost:3000";
global.request = require("supertest");
global.db = client.db(testDbName);
global.db = client.db();

0 comments on commit ec6a292

Please sign in to comment.