-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fb26e4
commit a7b3111
Showing
1 changed file
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,10 @@ beforeAll(async () => { | |
|
||
// Create users and contributions | ||
const users = [ | ||
{ email: "[email protected]", degree: "Computer Science", admissionYear: 2020 }, | ||
{ email: "[email protected]", degree: "Computer Science", admissionYear: 2021 }, | ||
{ email: "[email protected]", degree: "Industrial Engineering", admissionYear: 2020 }, | ||
{ email: "[email protected]", degree: "Computer Science", admissionYear: 2020, amount: 0 }, | ||
{ email: "[email protected]", degree: "Computer Science", admissionYear: 2020, amount: 200_00 }, | ||
{ email: "[email protected]", degree: "Computer Science", admissionYear: 2021, amount: 300_00 }, | ||
{ email: "[email protected]", degree: "Industrial Engineering", admissionYear: 2020, amount: 500_00 }, | ||
]; | ||
|
||
for (const user of users) { | ||
|
@@ -35,17 +36,19 @@ beforeAll(async () => { | |
volunteeringInterest: false | ||
}); | ||
|
||
const contribution = await createContribution({ | ||
dbClient: prisma, | ||
amountInCents: 100_00, | ||
email: user.email, | ||
}); | ||
if (user.amount > 0) { | ||
const contribution = await createContribution({ | ||
dbClient: prisma, | ||
amountInCents: user.amount, | ||
email: user.email, | ||
}); | ||
|
||
await completeContribution({ | ||
dbClient: prisma, | ||
contributionId: contribution.id, | ||
externalId: "test123", | ||
}); | ||
await completeContribution({ | ||
dbClient: prisma, | ||
contributionId: contribution.id, | ||
externalId: "test123", | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -63,23 +66,23 @@ describe("getRankingList", () => { | |
}); | ||
|
||
expect(result).toEqual({ | ||
amount: 300, | ||
amount: 1000, | ||
numberOfDonors: 3, | ||
ranking: [ | ||
{ | ||
position: 1, | ||
degree: "Computer Science", | ||
initialYear: 2020, | ||
finalYear: 2024, | ||
amount: 200, | ||
amount: 500, | ||
numberOfDonors: 2, | ||
}, | ||
{ | ||
position: 2, | ||
degree: "Industrial Engineering", | ||
initialYear: 2020, | ||
finalYear: 2024, | ||
amount: 100, | ||
amount: 500, | ||
numberOfDonors: 1, | ||
}, | ||
], | ||
|
@@ -94,15 +97,15 @@ describe("getRankingList", () => { | |
}); | ||
|
||
expect(result).toEqual({ | ||
amount: 200, | ||
amount: 500, | ||
numberOfDonors: 2, | ||
ranking: [ | ||
{ | ||
position: 1, | ||
degree: "Computer Science", | ||
initialYear: 2020, | ||
finalYear: 2024, | ||
amount: 200, | ||
amount: 500, | ||
numberOfDonors: 2, | ||
}, | ||
], | ||
|