Skip to content

Commit 9e2b576

Browse files
MelvinBotgrgia
andcommitted
Fix: Update CardUtilsTest assertions to match new filterAllInactiveCards behavior
Tests were asserting old behavior where only admin-zeroed suspended cards were kept. Updated to reflect the new logic: all suspended cards are kept when includeDeactivated is true, and STATE_DEACTIVATED cards are always excluded since the server rejects limit updates on them. Co-authored-by: Georgia Monahan <grgia@users.noreply.github.com>
1 parent b6bd285 commit 9e2b576

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/unit/CardUtilsTest.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,10 +3441,12 @@ describe('CardUtils', () => {
34413441
} as unknown as CardList;
34423442

34433443
const ids = Object.values(filterAllInactiveCards(cards, true)).map((c) => c.cardID);
3444-
expect(ids).toEqual(expect.arrayContaining([1, 3, 5]));
3444+
// All suspended cards are kept when includeDeactivated is true (admins can view/edit them)
3445+
expect(ids).toEqual(expect.arrayContaining([1, 5, 6]));
34453446
expect(ids).not.toContain(2);
3447+
// STATE_DEACTIVATED cards are always excluded (server rejects limit updates with 403)
3448+
expect(ids).not.toContain(3);
34463449
expect(ids).not.toContain(4);
3447-
expect(ids).not.toContain(6);
34483450
expect(ids).not.toContain(7);
34493451
expect(ids).not.toContain(8);
34503452
});
@@ -3495,11 +3497,13 @@ describe('CardUtils', () => {
34953497

34963498
const result = filterInactiveCardsForWorkspace(cardsList);
34973499
expect(result.active).toBeDefined();
3498-
expect(result.adminZeroedDeactivated).toBeDefined();
3500+
// All suspended cards are kept so admins can view and edit them
34993501
expect(result.adminZeroedSuspended).toBeDefined();
3502+
expect(result.nonZeroSuspended).toBeDefined();
35003503
expect(result.closed).toBeUndefined();
3504+
// STATE_DEACTIVATED cards are always excluded (server rejects limit updates with 403)
3505+
expect(result.adminZeroedDeactivated).toBeUndefined();
35013506
expect(result.deactivatedNonZero).toBeUndefined();
3502-
expect(result.nonZeroSuspended).toBeUndefined();
35033507
expect(result.deactivatedNoCustomFlag).toBeUndefined();
35043508
expect(result.cardList).toBeDefined();
35053509
});

0 commit comments

Comments
 (0)