test: flip anti-regression double XP — fix merged, assertion inversée
This commit is contained in:
@@ -233,21 +233,9 @@ describe('ListService', () => {
|
||||
|
||||
await service.updateStatus(1, 1, ListStatus.COMPLETED);
|
||||
|
||||
// THIS TEST DOCUMENTS THE BUG: updateStatus awards XP_COMPLETE
|
||||
// even when the entry is already COMPLETED.
|
||||
//
|
||||
// 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
|
||||
// FIX MERGED: updateStatus now guards against already-completed status.
|
||||
// addXp should NOT be called a second time.
|
||||
expect(userService.addXp).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user