-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update MongoDB test database configuration
- Loading branch information
1 parent
f705241
commit ec6a292
Showing
1 changed file
with
5 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |