refactor: replace cleanup service with focused temp role service and fix daily streaks

This commit is contained in:
syntaxbullet
2026-01-07 11:04:34 +01:00
parent 4a1e72c5f3
commit ca392749e3
9 changed files with 206 additions and 341 deletions

View File

@@ -209,6 +209,15 @@ describe("economyService", () => {
expect(result.streak).toBe(1);
});
it("should preserve streak if cooldown is missing but user has a streak", async () => {
mockFindFirst
.mockResolvedValueOnce(undefined) // No cooldown
.mockResolvedValueOnce({ id: 1n, dailyStreak: 10 });
const result = await economyService.claimDaily("1");
expect(result.streak).toBe(11);
});
it("should prevent weekly bonus exploit by resetting streak", async () => {
// Mock user at streak 7.
// Mock time as 24h + 1m after expiry.