Skip to content

Commit

Permalink
Fix updateUserTotalReceived() test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Nov 28, 2023
1 parent 6622ce1 commit 753e132
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/services/userService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ function updateUserTotalReceivedTestCases() {
...createProjectData(),
admin: String(user.id),
organizationLabel: ORGANIZATION_LABELS.GIVING_BLOCK,
totalDonations: 180,
totalDonations: 0,
});
const project2 = await saveProjectDirectlyToDb({
...createProjectData(),
admin: String(user.id),
organizationLabel: ORGANIZATION_LABELS.GIVING_BLOCK,
totalDonations: 190,
totalDonations: 0,
});
const qfRound = QfRound.create({
isActive: false,
Expand Down Expand Up @@ -149,11 +149,12 @@ function updateUserTotalReceivedTestCases() {
await owner?.save();

await updateTotalDonationsOfProject(project.id);
await updateTotalDonationsOfProject(project2.id);
await updateUserTotalReceived(user.id);

const updatedOwner = await findUserById(user.id);
assert.notEqual(owner!.totalReceived, updatedOwner!.totalReceived);
assert.equal(updatedOwner!.totalReceived, 180 + 190 + 150 + 160);
assert.equal(updatedOwner!.totalReceived, 150 + 160);
});
}

Expand Down

0 comments on commit 753e132

Please sign in to comment.