Skip to content

Commit 7bcdb26

Browse files
committed
updated tests and replaced res.send
1 parent f61ff70 commit 7bcdb26

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

controllers/users.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,14 @@ const migrate = async (req, res) => {
495495
await batchWrite.commit();
496496
}
497497

498-
return res.send({
499-
statusCode: 201,
498+
return res.staus(200).json({
499+
statusCode: 200,
500500
message: "All Users github_user_id added successfully",
501501
});
502502
} catch (error) {
503-
return res.status(500).send("Internal server error");
503+
return res.status(500).json({
504+
message: "Internal Server Error",
505+
});
504506
}
505507
};
506508

test/integration/users.test.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,14 +1039,6 @@ describe("Users", function () {
10391039
});
10401040

10411041
describe("POST /users/migrate", function () {
1042-
beforeEach(async function () {
1043-
superUserId = await addUser(superUser);
1044-
superUserAuthToken = authService.generateAuthToken({ userId: superUserId });
1045-
});
1046-
1047-
afterEach(async function () {
1048-
await cleanDb();
1049-
});
10501042
it("Should return 401 when user is unauthorize", function (done) {
10511043
chai
10521044
.request(app)

test/unit/models/users.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe("users", function () {
102102

103103
it("should update the github_id in the user collection", async function () {
104104
const userData = userDataArray[0];
105-
userData.github_user_id = "Yash Sinha";
105+
userData.github_id = "Yash Sinha";
106106

107107
// Add the user the first time
108108
const { userId } = await users.addOrUpdate(userData);

0 commit comments

Comments
 (0)