Skip to content

Commit 67c1dd9

Browse files
write test for monthly Hours
1 parent d346d59 commit 67c1dd9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

test/fixtures/userStatus/userStatus.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,18 @@ const generateUserStatusData = (state, updatedAt, from, until = "", message = ""
5151
};
5252
};
5353

54+
const generateMonthlyHours = (committed=0) =>{
55+
return {
56+
monthlyHours: {
57+
committed,
58+
},
59+
};
60+
}
61+
5462
module.exports = {
5563
userStatusDataForNewUser,
5664
userStatusDataForOooState,
5765
oooStatusDataForShortDuration,
5866
generateUserStatusData,
67+
generateMonthlyHours
5968
};

test/integration/userStatus.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const {
1515
userStatusDataForOooState,
1616
oooStatusDataForShortDuration,
1717
generateUserStatusData,
18+
generateMonthlyHours,
1819
} = require("../fixtures/userStatus/userStatus");
20+
const joinData = require("../fixtures/user/join");
1921

2022
const config = require("config");
2123
const { updateUserStatus } = require("../../models/userStatus");
@@ -368,6 +370,20 @@ describe("UserStatus", function () {
368370
});
369371
});
370372

373+
it("Should update the Monthly Hours", function (done) {
374+
chai
375+
.request(app)
376+
.patch(`/users/status/self`)
377+
.set("cookie", `${cookieName}=${jwt}`)
378+
.send(generateMonthlyHours(joinData()[2].numberOfHours))
379+
.end((err) => {
380+
if (err) {
381+
return done(err);
382+
}
383+
return done();
384+
});
385+
});
386+
371387
it("Should return 401 for unauthorized request", function (done) {
372388
chai
373389
.request(app)

0 commit comments

Comments
 (0)