Skip to content

Commit

Permalink
fix: Corrected error message and associated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Maelstromeous committed Jul 11, 2024
1 parent cae13a6 commit 05f67eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/general/services/purge.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,14 @@ DIG Community Staff`;

expect(() => service.preflightChecks(mockMessage as any)).toThrow(`Could not find PS2/Verified role! Pinging Bot Dev <@${devUserId}>!`);
});
it('should throw an error if the Foxhole role does not exist', async () => {
it('should throw an error if the Rec/Foxhole role does not exist', async () => {
mockMessage.guild.roles.cache.find = jest.fn()
.mockReturnValueOnce(mockRoleOnboarded)
.mockReturnValueOnce(mockRolePS2)
.mockReturnValueOnce(mockRolePS2Verified)
.mockReturnValueOnce(null);

expect(() => service.preflightChecks(mockMessage as any)).toThrow(`Could not find Foxhole role! Pinging Bot Dev <@${devUserId}>!`);
expect(() => service.preflightChecks(mockMessage as any)).toThrow(`Could not find Rec/Foxhole role! Pinging Bot Dev <@${devUserId}>!`);
});
it('should throw an error if the Albion Online role does not exist', async () => {
mockMessage.guild.roles.cache.find = jest.fn()
Expand Down
14 changes: 2 additions & 12 deletions src/general/services/purge.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class PurgeService {
}

if (!foxholeRole) {
throw new Error(`Could not find Foxhole role! Pinging Bot Dev <@${devUserId}>!`);
throw new Error(`Could not find Rec/Foxhole role! Pinging Bot Dev <@${devUserId}>!`);
}

if (!albionRole) {
Expand Down Expand Up @@ -440,7 +440,7 @@ DIG Community Staff`;
- Total humans at start of purge: **${purgables.totalHumans}**
- Total humans at end of purge: **${purgables.totalHumans - purgables.purgableMembers.size}**
- ⏳ Members in 1 week grace period: **${purgables.inGracePeriod}**
- 👞 Humans purged: **${purgables.purgableMembers.size}** (${percent}% of total members)
- 👞 Humans purged: **${purgables.purgableMembers.size}** (${percent}% of total server members)
- 😴 Humans inactive: **${purgables.inactive}** (${inactivePercent}% of purged)
- 🫨 Humans who failed to onboard: **${nonOnboarders}** (${nonOnboardersPercent}% of purged)`;

Expand All @@ -456,13 +456,3 @@ Note, these numbers will not add up to total numbers, as a member can be in mult
await originMessage.channel.send(gameStatsReport);
}
}

// ## 📜 Purge Report
// - Total members at start of purge: **10**
// - Total members at end of purge: **7**
// - Total humans at start of purge: **8**
// - Total humans at end of purge: **5**
// - ⏳ Members in 1 week grace period: **0**
// - 👞 Humans purged: **3** (37.0%)
// - 😴 Humans inactive: **1** (33.0% of purged)
// - 🫨 Humans who failed to onboard: **2** (66.0% of purged)

0 comments on commit 05f67eb

Please sign in to comment.