test: align voice quota tests with pro plan limits

This commit is contained in:
chahinebrini 2026-06-18 10:12:33 +02:00
parent 8a24ee890d
commit 057c6533af

View File

@ -59,7 +59,7 @@ describe("estimateAudioSeconds", () => {
// ─── getRemainingVoiceQuota ─────────────────────────────────────────────────── // ─── getRemainingVoiceQuota ───────────────────────────────────────────────────
describe("getRemainingVoiceQuota — free plan (60s)", () => { describe("getRemainingVoiceQuota — pro plan (300s)", () => {
it("returns 30s remaining after 30s consumed (same day)", async () => { it("returns 30s remaining after 30s consumed (same day)", async () => {
const todayMidnight = new Date(); const todayMidnight = new Date();
todayMidnight.setUTCHours(0, 0, 0, 0); todayMidnight.setUTCHours(0, 0, 0, 0);
@ -69,8 +69,8 @@ describe("getRemainingVoiceQuota — free plan (60s)", () => {
voiceQuotaResetAt: todayMidnight, // reset is today → no rollover voiceQuotaResetAt: todayMidnight, // reset is today → no rollover
}); });
const remaining = await getRemainingVoiceQuota("user-1", "free"); const remaining = await getRemainingVoiceQuota("user-1", "pro");
expect(remaining).toBe(30); // 60 - 30 expect(remaining).toBe(270); // 300 - 30
expect(mocks.profile.update).not.toHaveBeenCalled(); expect(mocks.profile.update).not.toHaveBeenCalled();
}); });
@ -79,11 +79,11 @@ describe("getRemainingVoiceQuota — free plan (60s)", () => {
todayMidnight.setUTCHours(0, 0, 0, 0); todayMidnight.setUTCHours(0, 0, 0, 0);
mocks.profile.findUnique.mockResolvedValueOnce({ mocks.profile.findUnique.mockResolvedValueOnce({
voiceSecondsUsedToday: 60, voiceSecondsUsedToday: 300,
voiceQuotaResetAt: todayMidnight, voiceQuotaResetAt: todayMidnight,
}); });
const remaining = await getRemainingVoiceQuota("user-1", "free"); const remaining = await getRemainingVoiceQuota("user-1", "pro");
expect(remaining).toBe(0); expect(remaining).toBe(0);
}); });
@ -96,7 +96,7 @@ describe("getRemainingVoiceQuota — free plan (60s)", () => {
voiceQuotaResetAt: todayMidnight, voiceQuotaResetAt: todayMidnight,
}); });
const remaining = await getRemainingVoiceQuota("user-1", "free"); const remaining = await getRemainingVoiceQuota("user-1", "pro");
expect(remaining).toBe(0); expect(remaining).toBe(0);
}); });
}); });
@ -112,8 +112,8 @@ describe("getRemainingVoiceQuota — day rollover", () => {
voiceQuotaResetAt: yesterday, voiceQuotaResetAt: yesterday,
}); });
const remaining = await getRemainingVoiceQuota("user-1", "free"); const remaining = await getRemainingVoiceQuota("user-1", "pro");
expect(remaining).toBe(60); // full plan quota after reset expect(remaining).toBe(300); // full plan quota after reset
// Should have reset the counter // Should have reset the counter
expect(mocks.profile.update).toHaveBeenCalledWith( expect(mocks.profile.update).toHaveBeenCalledWith(