Skip to content

Commit dadc5fc

Browse files
committed
test(recommendations): assert full SP group order and collapse symmetry
Address CodeRabbit nitpicks on the issue #135 SP-grouping tests: - groupSpCellKeys in-group order: assert the entire ordered sequence (expect(cellKeys).toEqual(sortedKeys)) instead of only index 0, so a regression that reorders later keys is caught. - SP group chevron toggle: add a second click + assertions so the test exercises collapse as well as expand (child rows hide, aria-expanded resets to false), locking toggle symmetry.
1 parent 6d08fbd commit dadc5fc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎frontend/src/__tests__/recommendations.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6942,7 +6942,7 @@ describe('Issue #135: groupSpCellKeys helper', () => {
69426942
const cellKeys = Array.from(result.values())[0]!;
69436943
// order must match sortedKeys order (insertion order here)
69446944
expect(cellKeys).toHaveLength(3);
6945-
expect(cellKeys[0]).toBe(sortedKeys[0]);
6945+
expect(cellKeys).toEqual(sortedKeys);
69466946
});
69476947

69486948
test('does not group SP recs from different accounts', () => {
@@ -7104,6 +7104,12 @@ describe('Issue #135: SP group parent row rendered in table', () => {
71047104
// aria-expanded should flip
71057105
const updatedChevron = document.querySelector<HTMLButtonElement>('.rec-sp-group-chevron');
71067106
expect(updatedChevron!.getAttribute('aria-expanded')).toBe('true');
7107+
7108+
// Collapse back: child rows should hide again and aria-expanded should reset.
7109+
updatedChevron!.click();
7110+
expect(document.querySelectorAll('.recommendation-row').length).toBe(0);
7111+
const collapsedChevron = document.querySelector<HTMLButtonElement>('.rec-sp-group-chevron');
7112+
expect(collapsedChevron!.getAttribute('aria-expanded')).toBe('false');
71077113
});
71087114

71097115
test('single SP plan type renders as a flat row with no group parent', async () => {

0 commit comments

Comments
 (0)