test: flip anti-regression double XP — fix merged, assertion inversée

This commit is contained in:
2026-04-05 07:37:55 +02:00
parent f83b07863d
commit 6dcb6bf4b5

View File

@@ -233,21 +233,9 @@ describe('ListService', () => {
await service.updateStatus(1, 1, ListStatus.COMPLETED); await service.updateStatus(1, 1, ListStatus.COMPLETED);
// THIS TEST DOCUMENTS THE BUG: updateStatus awards XP_COMPLETE // FIX MERGED: updateStatus now guards against already-completed status.
// even when the entry is already COMPLETED. // addXp should NOT be called a second time.
// expect(userService.addXp).not.toHaveBeenCalled();
// Current behavior (BUG): addXp IS called => test expects the call.
// When the fix lands, flip this assertion to:
// expect(userService.addXp).not.toHaveBeenCalled();
//
// Until then, this test proves the double-XP path exists.
const secondXpCalls = userService.addXp.mock.calls.filter(
([, amount]) => amount === XP_COMPLETE,
);
expect(secondXpCalls).toHaveLength(1); // BUG: this SHOULD be 0
// Total across both steps = 2 x XP_COMPLETE — the double-XP bug
// After fix, total should be exactly 1 x XP_COMPLETE
}); });
}); });