Skip to content

Commit 5484294

Browse files
committed
fixed sinon.stub timeout
1 parent 9569688 commit 5484294

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/integration/users.test.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,13 @@ describe("Users", function () {
10551055
});
10561056
});
10571057
it("Should update the user", async function () {
1058+
// Create a stub for the migrate function
1059+
const migrateStub = sinon.stub(controller, "migrate");
1060+
// Define the desired behavior of the stub
1061+
migrateStub.returns(userData[0]).resolves({
1062+
empty: true,
1063+
forEach: sinon.stub(),
1064+
});
10581065
const usersMigrateResponse = await chai
10591066
.request(app)
10601067
.post(`/users/migrate`)
@@ -1067,15 +1074,13 @@ describe("Users", function () {
10671074
totalCount: 0,
10681075
},
10691076
});
1070-
sinon.stub(controller, "migrate").returns(userData[0]).resolves({
1071-
empty: true,
1072-
forEach: sinon.stub(),
1073-
});
10741077
const usersReponse = await chai.request(app).get(`/users`).set("cookie", `${cookieName}=${superUserAuthToken}`);
10751078
expect(usersReponse).to.have.status(200);
10761079
usersReponse.body.users.forEach((document) => {
10771080
expect(document).to.have.property(`github_user_id`);
10781081
});
1082+
// Restore the original migrate function
1083+
migrateStub.restore();
10791084
});
10801085
it("Should return unauthorized error when not logged in", function (done) {
10811086
chai

0 commit comments

Comments
 (0)