Skip to content

wip#1572

Merged
simo6529 merged 3 commits intomainfrom
create-group-include-me-fix
Oct 28, 2025
Merged

wip#1572
simo6529 merged 3 commits intomainfrom
create-group-include-me-fix

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Oct 28, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation when updating group membership so inclusion toggles won't create inconsistent states if a primary wallet isn't present.
  • Tests

    • Refreshed and strengthened UI and calendar tests (overflow menus, identity search accessibility, profile list interactions, dropdown items, DST-aware calendar times) and expanded group-edit test flows to better simulate real-world publish/create scenarios.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 28, 2025

Walkthrough

Added a guard in group creation to avoid updating inclusion when toggling iAmIncluded true without a primary wallet, moved the iAmIncluded update after that check, and tightened the condition that appends the primary wallet to identity_addresses to require both newState true and a primaryWallet.

Changes

Cohort / File(s) Summary
Group create inclusion guard
components/groups/page/create/GroupCreate.tsx
Added early-return when toggling inclusion to true with no primaryWallet; moved iAmIncluded state update to after the guard; only append primaryWallet to identity_addresses when newState === true AND primaryWallet exists.
Tests — accessibility & async updates
__tests__/components/common/TabToggleWithOverflow.test.tsx, __tests__/components/utils/input/identity/IdentitySearch.test.tsx, __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx, __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx, __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
Adjusted test interactions to use explicit focus/roles (combobox, menuitem), moved assertions to async checks (waitFor, findBy*), updated targets and expected element counts/roles/alt text, and changed click targets to reflect markup/ARIA updates.
Tests — date/time expectation update
__tests__/components/meme-calendar/meme-calendar.helpers.test.ts
Updated expected UTC timestamps for Eastern time DST transition test cases (ISO strings changed).
Tests — react-query mocks & group flows
__tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx, __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
Replaced minimal react-query mocks with fuller mocks for useMutation, useQuery, and useQueryClient; added queryClientMock; enabled ref-based child component mocks; added new test flows simulating creating a new group (new-group-id) and updated expectations/messages.
Docs / ticket log
codex/tickets/TKT-0012.md
Added a log entry noting tests refreshed to mock query client utilities and new identity flows.

Sequence Diagram(s)

sequenceDiagram
  participant UI as GroupCreate UI
  participant State as Local State
  participant Wallet as PrimaryWalletService

  Note over UI,State: User toggles "I am included"
  UI->>Wallet: request primaryWallet (may be null)
  alt no primaryWallet and toggling ON
    Wallet-->>UI: null
    UI->>State: early return (no iAmIncluded update)
    Note right of State: no wallet appended
  else primaryWallet exists or toggling OFF
    Wallet-->>UI: primaryWallet
    UI->>State: set iAmIncluded (update placed after guard)
    alt newState true and primaryWallet exists
      UI->>State: append primaryWallet to identity_addresses
    else newState false
      UI->>State: remove primaryWallet from identity_addresses (if present)
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay special attention to components/groups/page/create/GroupCreate.tsx for edge cases (race with async wallet resolution).
  • Review tests that replace react-query mocks (useQuery, useQueryClient, useMutation) for realistic behavior and flakiness risk.
  • Verify updated async assertions in accessibility-related tests to avoid timing/scheduling flakiness.

Possibly related PRs

Suggested reviewers

  • ragnep
  • prxt6529

Poem

"I nibble through the code tonight,
Guarding wallets with gentle bite.
If no primary hops in view,
I stop the change and skip the queue.
A tidy state, a happier site!" 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The pull request title is "wip," which is a vague, non-descriptive placeholder term that does not convey any meaningful information about the changeset. While the branch name "create-group-include-me-fix" suggests the work addresses primary wallet inclusion logic in group creation, and the actual changes involve fixes to GroupCreate.tsx and updates to multiple test files, the title itself fails to communicate what has been changed or what problem is being addressed. A reviewer scanning the project history would not understand the primary purpose of this pull request from the title alone. Update the pull request title to be descriptive and specific about the main change. For example: "Fix primary wallet inclusion state in group creation" or "Guard against updating inclusion state without primary wallet" would clearly communicate the primary objective. The title should reflect either the main production code change (the GroupCreate.tsx fix) or the overall purpose of the work to make the changeset's intent clear to reviewers.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch create-group-include-me-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/groups/page/create/GroupCreate.tsx (1)

188-190: Optional: Simplify redundant condition.

The primaryWallet check here is redundant because the early return at lines 178-180 already guarantees that if newState is true, primaryWallet must exist. You could simplify this to if (newState).

However, the current form is more defensive and explicit, which may be preferable for clarity.

-    if (newState && primaryWallet) {
+    if (newState) {
       newAddresses.push(primaryWallet);
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7288494 and 355ee6c.

📒 Files selected for processing (1)
  • components/groups/page/create/GroupCreate.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Do not include any comments in the code
Use react-query for data fetching
Always add readonly before props

Use TypeScript across the codebase

Files:

  • components/groups/page/create/GroupCreate.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursorrules)

**/*.tsx: Use FontAwesome for icons
Use TailwindCSS for styling

Use React functional components with hooks for UI components

Files:

  • components/groups/page/create/GroupCreate.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
components/groups/page/create/GroupCreate.tsx (1)

178-181: LGTM! Good defensive guard.

The early return when attempting to include the user without a primary wallet prevents invalid state updates. The placement of setIAmIncluded after this guard ensures the state is only updated when it's safe to proceed.

Signed-off-by: Simo <simo@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Oct 28, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
1 Accepted issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (10)
__tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx (2)

16-16: Good change to menuitem role, but consider using userEvent.

The update to target menuitem role improves accessibility and semantic correctness.

However, the test uses fireEvent instead of userEvent from @testing-library/user-event, which deviates from the coding guidelines. userEvent more closely simulates real user interactions and is the recommended approach.

Apply this diff to use userEvent:

-import { render, screen, fireEvent, act } from '@testing-library/react';
+import { render, screen, act } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';

Then update the test:

-  fireEvent.click(screen.getByRole('menuitem', { name: 'Item' }));
+  await userEvent.click(screen.getByRole('menuitem', { name: 'Item' }));

Note: You'll need to make the test async:

-test('calls setSelected on click', () => {
+test('calls setSelected on click', async () => {

As per coding guidelines.


25-25: Menuitem role improves test reliability.

The change to menuitem role correctly reflects the component's accessible structure and makes the test more robust.

The use of querySelector('svg') works but is less maintainable than @testing-library queries. Consider adding a data-testid or using getByRole if the SVG has an accessible role.

__tests__/components/utils/input/identity/IdentitySearch.test.tsx (1)

20-31: Consider migrating from fireEvent to userEvent for more realistic interactions.

As per coding guidelines, React component tests should use @testing-library/user-event instead of fireEvent. This provides more realistic user interaction simulation.

Apply this refactor:

-import { render, screen, fireEvent } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';

Then update the test:

-  it('opens dropdown after typing and selects value', () => {
+  it('opens dropdown after typing and selects value', async () => {
+    const user = userEvent.setup();
     render(<IdentitySearch identity={null} setIdentity={setIdentity} />);
     const input = screen.getByRole('combobox', { name: 'Identity' });
-    fireEvent.focus(input);
+    await user.click(input);
     expect(receivedProps.open).toBe(false);
-    fireEvent.change(input, { target: { value: 'a' } });
+    await user.type(input, 'a');
     expect(receivedProps.open).toBe(false);
-    fireEvent.change(input, { target: { value: 'abc' } });
+    await user.clear(input);
+    await user.type(input, 'abc');
     expect(receivedProps.open).toBe(true);
     receivedProps.onProfileSelect({ handle: 'user' });
     expect(setIdentity).toHaveBeenCalledWith('user');
   });

And update the second test similarly:

-  it('clears identity when clear button clicked', () => {
+  it('clears identity when clear button clicked', async () => {
+    const user = userEvent.setup();
     render(<IdentitySearch identity="bob" setIdentity={setIdentity} />);
-    fireEvent.click(screen.getByLabelText('Clear identity'));
+    await user.click(screen.getByLabelText('Clear identity'));
     expect(setIdentity).toHaveBeenCalledWith(null);
   });

As per coding guidelines.

__tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx (2)

66-74: Good mock structure; consider removing redundant module-level setup.

The queryClientMock is well-structured. However, lines 72-74 duplicate the mock configuration that's already done in beforeEach (lines 130-132). Since beforeEach runs before each test and reconfigures all mocks, the module-level setup is redundant.

Consider removing the redundant module-level mock setup:

 const queryClientMock = {
   ensureQueryData: jest.fn(),
   fetchQuery: jest.fn(),
   setQueryData: jest.fn(),
 };
-
-(useMutation as jest.Mock).mockReturnValue({ mutateAsync });
-(useQuery as jest.Mock).mockReturnValue({ data: undefined });
-(useQueryClient as jest.Mock).mockImplementation(() => queryClientMock);

135-176: Consider using userEvent instead of fireEvent.

The tests currently use fireEvent, which works but is lower-level. The coding guidelines specify using @testing-library/user-event for React component tests, which better simulates real user interactions including timing, event sequences, and focus management.

As per coding guidelines.

Example refactor for one test:

+import userEvent from '@testing-library/user-event';
+
 describe('WaveGroupEditButtons', () => {
   beforeEach(() => {
     // ...
   });

   it('opens menu and calls mutate on edit', async () => {
+    const user = userEvent.setup();
     render(<WaveGroupEditButtons haveGroup wave={wave} type={WaveGroupType.VIEW} />, { wrapper });
-    fireEvent.click(screen.getByRole('button', { name: /Group options/i }));
-    fireEvent.click(screen.getByText('Change group'));
+    await user.click(screen.getByRole('button', { name: /Group options/i }));
+    await user.click(screen.getByText('Change group'));
     await waitFor(() => expect(auth.requestAuth).toHaveBeenCalled());
     expect(mutateAsync).toHaveBeenCalled();
   });

Apply similar changes to the remaining tests.

__tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx (5)

39-43: Broaden queryClient mock surface to avoid brittle tests.

Add common no‑ops like invalidateQueries and getQueryData to match v5 usage patterns and prevent future breakage.

 const queryClientMock = {
   ensureQueryData: jest.fn(),
   fetchQuery: jest.fn(),
   setQueryData: jest.fn(),
+  invalidateQueries: jest.fn(),
+  getQueryData: jest.fn(),
 };

115-132: Prevent double execution of queryFn in useQuery mock.

Calling queryFn inside useQuery plus ensureQueryData/fetchQuery can fetch twice and introduce flakiness. Return stable shape without side effects.

-  (useQuery as jest.Mock).mockImplementation(({ enabled, queryFn }) => {
-    if (enabled && typeof queryFn === "function") {
-      void queryFn({ signal: undefined });
-    }
-    return { data: undefined };
-  });
+  (useQuery as jest.Mock).mockImplementation(() => ({
+    data: undefined,
+    isFetching: false,
+    isPending: false,
+    status: 'success',
+  }));

133-148: Augment useMutation mock to mirror v5 shape.

Add mutate alias and status flags to better emulate @tanstack/react-query v5 and future‑proof dependent logic.

-  (useMutation as jest.Mock).mockImplementation((options: any) => ({
-    mutateAsync: async (params?: any) => {
+  (useMutation as jest.Mock).mockImplementation((options: any) => ({
+    status: 'idle',
+    isPending: false,
+    mutate: (params?: any) => {
+      // fire-and-forget alias that calls mutateAsync under the hood
+      // errors are intentionally unhandled here to mirror real mutate
+      // eslint-disable-next-line @typescript-eslint/no-floating-promises
+      (async () => { await (useMutation as any).mock.results.at(-1).value.mutateAsync(params); })();
+    },
+    mutateAsync: async (params?: any) => {
       try {
         const result = await options.mutationFn(params);
         options.onSuccess?.(result, params, undefined);
         options.onSettled?.(result, undefined, params, undefined);
         mutateAsyncSpy(params);
         return result;
       } catch (error) {
         options.onError?.(error, params, undefined);
         options.onSettled?.(undefined, error, params, undefined);
         mutateAsyncSpy(params);
         throw error;
       }
     },
   }));

169-175: DRY up repeated 'groups/new-group-id' endpoint stubs.

Extract a small helper to register this common case across tests to reduce duplication.

+const mockFetchNewGroup = () => ({
+  ...baseGroupFull,
+  id: 'new-group-id',
+  visible: true,
+});
...
-      if (endpoint === 'groups/new-group-id') {
-        return Promise.resolve({
-          ...baseGroupFull,
-          id: 'new-group-id',
-          visible: true,
-        });
-      }
+      if (endpoint === 'groups/new-group-id') return Promise.resolve(mockFetchNewGroup());

Also applies to: 279-285, 325-331


218-229: New “no scoped group” path covered — add one more payload assertion.

Great coverage of create→publish flow and toast. Optionally assert that identity casing is normalized in the payload to catch regressions.

+    const payloadArg = mockCreateGroup.mock.calls[0][0].payload;
+    expect(payloadArg.group.identity_addresses).toContain('0xface');

Also applies to: 242-242, 251-265

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 355ee6c and 304c587.

📒 Files selected for processing (9)
  • __tests__/components/common/TabToggleWithOverflow.test.tsx (1 hunks)
  • __tests__/components/meme-calendar/meme-calendar.helpers.test.ts (1 hunks)
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx (1 hunks)
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx (1 hunks)
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx (1 hunks)
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx (2 hunks)
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx (3 hunks)
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx (10 hunks)
  • codex/tickets/TKT-0012.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • codex/tickets/TKT-0012.md
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Do not include any comments in the code
Use react-query for data fetching
Always add readonly before props

Use TypeScript across the codebase

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/meme-calendar/meme-calendar.helpers.test.ts
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursorrules)

**/*.tsx: Use FontAwesome for icons
Use TailwindCSS for styling

Use React functional components with hooks for UI components

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
__tests__/**

📄 CodeRabbit inference engine (tests/AGENTS.md)

Place Jest test suites under the __tests__ directory mirroring source folders (e.g., components, contexts, hooks, utils)

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/meme-calendar/meme-calendar.helpers.test.ts
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
__tests__/components/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (tests/AGENTS.md)

Use @testing-library/react and @testing-library/user-event for React component tests

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/meme-calendar/meme-calendar.helpers.test.ts
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
**/__tests__/**

📄 CodeRabbit inference engine (AGENTS.md)

Place tests in __tests__ directories when organizing test suites

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/meme-calendar/meme-calendar.helpers.test.ts
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
**/*.test.tsx

📄 CodeRabbit inference engine (AGENTS.md)

When colocating tests with components, name them ComponentName.test.tsx

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Mock external dependencies and APIs in tests

Files:

  • __tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx
  • __tests__/components/meme-calendar/meme-calendar.helpers.test.ts
  • __tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx
  • __tests__/components/common/TabToggleWithOverflow.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx
  • __tests__/components/utils/select/dropdown/CommonDropdownItem.test.tsx
  • __tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx
  • __tests__/components/utils/input/identity/IdentitySearch.test.tsx
🧬 Code graph analysis (2)
__tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx (1)
components/utils/input/profile-search/CommonProfileSearchItems.tsx (1)
  • CommonProfileSearchItems (7-159)
__tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx (1)
components/utils/input/profile-search/CommonProfileSearchItem.tsx (1)
  • CommonProfileSearchItem (7-88)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (14)
__tests__/components/utils/input/identity/IdentitySearch.test.tsx (2)

22-22: LGTM! Improved accessibility testing.

Using getByRole('combobox', { name: 'Identity' }) is a more semantic and accessible way to query the input element, ensuring the component properly exposes ARIA roles and labels.


26-28: LGTM! Proper dropdown state verification.

The assertions correctly verify that the dropdown remains closed after typing a single character ('a') and only opens after typing three characters ('abc'), ensuring the minimum character threshold is enforced.

__tests__/components/utils/input/profile-search/CommonProfileSearchItems.test.tsx (1)

27-27: Verify that these test changes belong in this PR.

The test assertions have been correctly updated to expect 2 occurrences of each message (one in the screen-reader <select> and one in the visible <li>), which accurately reflects the component's dual-rendering for accessibility. However, these profile search test changes appear unrelated to the PR objectives, which describe group creation and iAmIncluded guard logic.

Please confirm whether these test updates are intentional for this PR or if they should be moved to a separate PR focused on profile search improvements.

Also applies to: 32-32

__tests__/components/utils/input/profile-search/CommonProfileSearchItem.test.tsx (2)

9-16: LGTM: Correct semantic HTML structure.

Wrapping the <CommonProfileSearchItem> in a <ul> element is semantically correct, as <li> elements must be children of list elements. This ensures valid HTML structure during testing.


18-26: LGTM: Test accurately reflects component implementation.

The test updates correctly match the component's actual behavior:

  • Alt text "Alice avatar" matches the implementation's avatarAltText construction
  • Selecting by text and then finding the closest <li> correctly targets the component's root element
  • Asserting data-option-id attribute verifies proper ID assignment
  • SVG assertion confirms the checkmark icon renders when selected
  • Clicking the list item directly is correct, as the onClick handler is attached to the <li> element

Note: Like the previous test file, these profile search changes appear unrelated to the PR's stated objectives about group creation logic.

__tests__/components/common/TabToggleWithOverflow.test.tsx (4)

93-94: Consider restoring keyboard navigation if possible.

Replacing await user.tab() with moreButton.focus() reduces test coverage of keyboard navigation to reach the button. While programmatic focus may be necessary to fix flaky behavior, it's less representative of real user interaction.

Verify whether:

  1. The tab navigation was causing test flakiness
  2. The component's focus management changed
  3. Keyboard navigation to the button is tested elsewhere

If focus issues have been resolved, consider restoring the original approach:

-    moreButton.focus();
-    expect(moreButton).toHaveFocus();
+    await user.tab(); // focus More tabs button

96-99: LGTM! Excellent async handling.

Wrapping the aria-expanded assertion in waitFor and using await screen.findByRole properly handles the asynchronous menu rendering. This prevents race conditions and makes the test more robust.


104-108: LGTM! Proper async assertions for menu closing.

Using separate waitFor blocks for the aria-expanded state change and menu item removal ensures both the state update and DOM cleanup complete before proceeding. This makes the test more reliable.


111-113: LGTM! Consistent async handling.

Wrapping the aria-expanded assertion in waitFor maintains consistency with the earlier Enter key test and properly handles the asynchronous state change when reopening the menu with the Space key.

__tests__/components/waves/specs/groups/group/edit/WaveGroupEditButtons.test.tsx (3)

7-13: LGTM! Comprehensive React Query mock coverage.

The expanded mocks for useQuery and useQueryClient enable better test coverage of query-dependent scenarios.


17-28: LGTM! Proper ref forwarding implementation.

The forwardRef pattern correctly handles both callback refs and object refs, enabling parent components to imperatively trigger the open handler. The implementation is React 19 compatible.

Also applies to: 33-44


123-132: LGTM! Thorough test isolation setup.

The beforeEach comprehensively resets all mocks and establishes a clean, predictable state for each test. This ensures proper test isolation.

__tests__/components/waves/specs/groups/group/edit/buttons/useWaveGroupEditButtonsController.test.tsx (2)

203-208: Correct assertion for publish payload (id + oldVersionId).

Solid check that publish uses the recreated group id and previous version id.


8-8: React Query mocks extended — verified and approved.

Jest alias mapping for @/ is properly configured in jest.config.js with "^@/(.*)$": "<rootDir>/$1", so the imports will resolve correctly. Module mock hoisting is standard Jest behavior and will apply before module evaluation. The test setup looks good.

Comment thread __tests__/components/meme-calendar/meme-calendar.helpers.test.ts
@simo6529 simo6529 merged commit 2def172 into main Oct 28, 2025
10 checks passed
@simo6529 simo6529 deleted the create-group-include-me-fix branch October 28, 2025 10:06
@coderabbitai coderabbitai Bot mentioned this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants