Skip to content

Commit

Permalink
Merge pull request #190 from Captain-Quack/Mocha-+-Chai
Browse files Browse the repository at this point in the history
Have the repository use Mocha and Chai to test stuff
  • Loading branch information
geoffrey-wu authored Jul 1, 2023
2 parents 4d18ecb + 3fc217a commit c5bffc4
Show file tree
Hide file tree
Showing 5 changed files with 1,074 additions and 210 deletions.
13 changes: 10 additions & 3 deletions database/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ import { MongoClient, ObjectId } from 'mongodb';

const uri = `mongodb+srv://${process.env.MONGODB_USERNAME || 'geoffreywu42'}:${process.env.MONGODB_PASSWORD || 'password'}@qbreader.0i7oej9.mongodb.net/?retryWrites=true&w=majority`;
const client = new MongoClient(uri);
client.connect().then(async () => {
console.log('connected to mongodb');
});

async function connectToDatabase(log=false) {
await client.connect();

if (log) {
console.log('connected to mongodb');
}
}

await connectToDatabase(true);

const database = client.db('qbreader');

Expand Down Expand Up @@ -600,6 +606,7 @@ async function reportQuestion(_id, reason, description, verbose = true) {


export {
connectToDatabase,
getBonusById,
getNumPackets,
getPacket,
Expand Down
Loading

0 comments on commit c5bffc4

Please sign in to comment.