Skip to content

Commit aee3bdd

Browse files
committed
fixed testcases to add replicas to memory server and fixed faculty testcases
1 parent d281aeb commit aee3bdd

File tree

3 files changed

+533
-109
lines changed

3 files changed

+533
-109
lines changed

controller/faculty.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ async function addFaculty(req, res) {
8080
addNewEmployeeCurrent(employeeCurrentDetails, session),
8181
createEmployeeBank(employeeBankDetails, session),
8282
]);
83-
res.json({ res: `added faculty ${newFaculty.ERPID}` });
83+
res.json({
84+
res: `added faculty ${newFaculty.ERPID}`,
85+
id: newFaculty.ERPID,
86+
});
8487
await session.commitTransaction();
8588
session.endSession();
8689
} catch (error) {

test/config/globalSetup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { spawn } from "child_process";
2-
import { MongoMemoryServer } from "mongodb-memory-server";
2+
import { MongoMemoryReplSet } from "mongodb-memory-server";
33
import { config } from "./config.js"; // eslint-disable-line import/extensions
44

55
function runChildProcessWithTimeout(command, args, timeout) {
@@ -36,7 +36,7 @@ export default async function globalSetup() {
3636
if (config.Memory) {
3737
// Config to decided if an mongodb-memory-server instance should be used
3838
// it"s needed in global space, because we don"t want to create a new instance every test-suite
39-
const instance = await MongoMemoryServer.create();
39+
const instance = await MongoMemoryReplSet.create({ replSet: { count: 4 } });
4040
const uri = instance.getUri();
4141
global.MONGOINSTANCE = instance;
4242
process.env.DB_URL = uri.slice(0, uri.lastIndexOf("/"));

0 commit comments

Comments
 (0)