Skip to content

test(frontend): cover guild automation route access - #366

Merged
LucasSantana-Dev merged 9 commits into
mainfrom
fix/guild-automation-route-coverage
Mar 27, 2026
Merged

LucasSantana-Dev merged 9 commits into
mainfrom
fix/guild-automation-route-coverage

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Mar 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add a positive route test for /guild-automation when a member has settings: 'manage'
  • keep regression coverage aligned with the existing settings-based access guard on current main
  • avoid reintroducing stale sidebar code from the older local checkout by only packaging the net-new test coverage

Summary by CodeRabbit

  • Tests
    • Added an authenticated route test validating the Guild Automation page renders for users with manage permissions; updated multiple tests to use accessibility attributes/selectors, refined labels/assertions, and expanded server card checks (guild selection + navigation, bot install/active indicators, member count, Add Bot action).
  • Chores
    • Adjusted install-time command to set an environment variable that skips certain download behavior during dependency installation.

@vercel

vercel Bot commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Mar 26, 2026 9:28pm

Request Review

@coderabbitai

coderabbitai Bot commented Mar 26, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LucasSantana-Dev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 57 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea922ad1-ebaf-4021-9ea6-e90bdad1743c

📥 Commits

Reviewing files that changed from the base of the PR and between 7361196 and fdcb00f.

📒 Files selected for processing (5)
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
  • packages/frontend/src/pages/Login.test.tsx
  • packages/frontend/src/pages/Moderation.test.tsx
  • packages/frontend/src/pages/Music.test.tsx
  • packages/frontend/src/pages/ServersPage.test.tsx
📝 Walkthrough

Walkthrough

Added and adjusted frontend tests: a new authenticated-route test for /guild-automation, updates to sidebar and layout test assertions (accessibility selectors and active-link checks), revisions to ServerCard test expectations and mocks, and a small change to vercel.json installCommand.

Changes

Cohort / File(s) Summary
Auth route: Guild Automation
packages/frontend/src/App.authRoutes.test.tsx
Added an authenticated routing test that mocks an authenticated user with selectedGuild.effectiveAccess including overview: 'manage' and settings: 'manage', renders /guild-automation, and asserts the "Guild Automation Page" heading is present.
Layout / Sidebar tests
packages/frontend/src/components/Layout/Sidebar.test.tsx, packages/frontend/src/components/Layout/Layout.test.tsx
Updated sidebar tests to use accessible name /open navigation menu/i, switched active-link assertion to aria-current="page", adjusted expected mobile sidebar width class (w-64), and changed layout tests to assert active-server as a button with an accessible name containing the selected guild.
ServerCard tests
packages/frontend/src/components/Dashboard/ServerCard.test.tsx
Mocked useGuildStore/selectGuild; updated "Manage" test to assert selectGuild is called and navigation occurs; adjusted accessibility labels, icon URL expectation (?size=128), bot badge texts/classes, added member count rendering assertion, and updated "Add Bot" button assertion.
CI / Deploy config
vercel.json
Changed installCommand from npm ci to YOUTUBE_DL_SKIP_DOWNLOAD=true npm ci.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ci

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test(frontend): cover guild automation route access' directly aligns with the main change: adding a new authenticated routing test case for the /guild-automation route with proper access control coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/guild-automation-route-coverage

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.

@github-actions

github-actions Bot commented Mar 26, 2026 •

Copy link
Copy Markdown

Size Change: +2 B (0%)

Total Size: 317 kB

Filename Size Change
packages/frontend/dist/assets/AutoMessages-CbCQRuhw.js 0 B -2.68 kB (removed) 🏆
packages/frontend/dist/assets/AutoMod-iy1gwSQQ.js 0 B -3.64 kB (removed) 🏆
packages/frontend/dist/assets/CommandsConfig-D4iMPk-m.js 0 B -1.47 kB (removed) 🏆
packages/frontend/dist/assets/Config-9O-LJLTb.js 0 B -1.68 kB (removed) 🏆
packages/frontend/dist/assets/DashboardOverview-Bak4r0rZ.js 0 B -2.54 kB (removed) 🏆
packages/frontend/dist/assets/EmbedBuilder-Ch7-OXF8.js 0 B -3.34 kB (removed) 🏆
packages/frontend/dist/assets/Features-Bn6CVxJ6.js 0 B -2.85 kB (removed) 🏆
packages/frontend/dist/assets/GuildAutomation-Dl0csul9.js 0 B -2.92 kB (removed) 🏆
packages/frontend/dist/assets/index-C1kYHC0Q.css 0 B -14 kB (removed) 🏆
packages/frontend/dist/assets/index-DVwdFhhM.js 0 B -27.3 kB (removed) 🏆
packages/frontend/dist/assets/label-BUbVMLXt.js 0 B -488 B (removed) 🏆
packages/frontend/dist/assets/Levels-ByStePVk.js 0 B -2.63 kB (removed) 🏆
packages/frontend/dist/assets/Login-Bi2LqgTx.js 0 B -2.52 kB (removed) 🏆
packages/frontend/dist/assets/Lyrics-Bv2fB-O8.js 0 B -1.33 kB (removed) 🏆
packages/frontend/dist/assets/Moderation-B69kseK9.js 0 B -3.85 kB (removed) 🏆
packages/frontend/dist/assets/Music-CGRI-wuL.js 0 B -6.13 kB (removed) 🏆
packages/frontend/dist/assets/MusicConfig-BiVrrE53.js 0 B -1.6 kB (removed) 🏆
packages/frontend/dist/assets/ReactionRoles-CHriswr6.js 0 B -1.89 kB (removed) 🏆
packages/frontend/dist/assets/ServerLogs-C6rt2EcT.js 0 B -2.9 kB (removed) 🏆
packages/frontend/dist/assets/ServerSettings-jy3rjdVP.js 0 B -4.22 kB (removed) 🏆
packages/frontend/dist/assets/ServersPage-DSWlh4ZF.js 0 B -2.92 kB (removed) 🏆
packages/frontend/dist/assets/Starboard-D_NqyHwC.js 0 B -2.08 kB (removed) 🏆
packages/frontend/dist/assets/TrackHistory-AaSsvBX6.js 0 B -1.9 kB (removed) 🏆
packages/frontend/dist/assets/TwitchNotifications-BuCVAO44.js 0 B -2.26 kB (removed) 🏆
packages/frontend/dist/assets/AutoMessages-CB8IFn3v.js 2.68 kB +2.68 kB (new file) 🆕
packages/frontend/dist/assets/AutoMod-C9PJVx6l.js 3.64 kB +3.64 kB (new file) 🆕
packages/frontend/dist/assets/CommandsConfig-DQXieP40.js 1.47 kB +1.47 kB (new file) 🆕
packages/frontend/dist/assets/Config-DOuRK97i.js 1.68 kB +1.68 kB (new file) 🆕
packages/frontend/dist/assets/DashboardOverview-BtRRwUgl.js 2.54 kB +2.54 kB (new file) 🆕
packages/frontend/dist/assets/EmbedBuilder-1VV-z161.js 3.34 kB +3.34 kB (new file) 🆕
packages/frontend/dist/assets/Features-CtJ-jeMD.js 2.85 kB +2.85 kB (new file) 🆕
packages/frontend/dist/assets/GuildAutomation-DeM3B2Fr.js 2.92 kB +2.92 kB (new file) 🆕
packages/frontend/dist/assets/index-BetRVevx.css 14 kB +14 kB (new file) 🆕
packages/frontend/dist/assets/index-dN1uLG9X.js 27.3 kB +27.3 kB (new file) 🆕
packages/frontend/dist/assets/label-jZJxdIcz.js 490 B +490 B (new file) 🆕
packages/frontend/dist/assets/Levels-D5Mb4F00.js 2.63 kB +2.63 kB (new file) 🆕
packages/frontend/dist/assets/Login-C0Y7niYr.js 2.52 kB +2.52 kB (new file) 🆕
packages/frontend/dist/assets/Lyrics-EQgZ6tEm.js 1.34 kB +1.34 kB (new file) 🆕
packages/frontend/dist/assets/Moderation-Cs8-f-GL.js 3.85 kB +3.85 kB (new file) 🆕
packages/frontend/dist/assets/Music-ebwVIzul.js 6.13 kB +6.13 kB (new file) 🆕
packages/frontend/dist/assets/MusicConfig-BKwnMZ8G.js 1.6 kB +1.6 kB (new file) 🆕
packages/frontend/dist/assets/ReactionRoles-svSV_6TP.js 1.89 kB +1.89 kB (new file) 🆕
packages/frontend/dist/assets/ServerLogs-COwIN5xr.js 2.9 kB +2.9 kB (new file) 🆕
packages/frontend/dist/assets/ServerSettings-CVheOCuB.js 4.22 kB +4.22 kB (new file) 🆕
packages/frontend/dist/assets/ServersPage-Ez07UnTM.js 2.92 kB +2.92 kB (new file) 🆕
packages/frontend/dist/assets/Starboard-DMPe0zeP.js 2.08 kB +2.08 kB (new file) 🆕
packages/frontend/dist/assets/TrackHistory-D1Z39T0x.js 1.9 kB +1.9 kB (new file) 🆕
packages/frontend/dist/assets/TwitchNotifications-uFHlW9AS.js 2.26 kB +2.26 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
packages/frontend/dist/assets/ActionPanel-3_0PgOXq.js 402 B
packages/frontend/dist/assets/api-3qPvg92E.js 2.9 kB
packages/frontend/dist/assets/authStore-ChjcqfIB.js 557 B
packages/frontend/dist/assets/badge-CspLvx5p.js 499 B
packages/frontend/dist/assets/Card-8wz5ivnN.js 455 B
packages/frontend/dist/assets/CustomCommands-BZz5vFg7.js 2.16 kB
packages/frontend/dist/assets/dialog-BjohnkaC.js 948 B
packages/frontend/dist/assets/guildStore-BuJ9Xfyw.js 794 B
packages/frontend/dist/assets/input-cs-qnOBU.js 462 B
packages/frontend/dist/assets/LastFm-DrttiwyL.js 1.74 kB
packages/frontend/dist/assets/PrivacyPolicy-DUO0quHd.js 1.38 kB
packages/frontend/dist/assets/rolldown-runtime-COnpUsM8.js 467 B
packages/frontend/dist/assets/SectionHeader-zj4yO164.js 382 B
packages/frontend/dist/assets/select-GX-kiy8o.js 1.22 kB
packages/frontend/dist/assets/Skeleton-yy-5yIDL.js 234 B
packages/frontend/dist/assets/StatTile-DJZkmGlP.js 605 B
packages/frontend/dist/assets/switch-DAVOcxrK.js 542 B
packages/frontend/dist/assets/TermsOfService-B0ThRl8c.js 1.37 kB
packages/frontend/dist/assets/usePageMetadata-DNK___tM.js 326 B
packages/frontend/dist/assets/utils-FIhK1p0l.js 148 B
packages/frontend/dist/assets/vendor-forms-KXRApnAU.js 25.4 kB
packages/frontend/dist/assets/vendor-radix-Uy8m4UkR.js 33.5 kB
packages/frontend/dist/assets/vendor-react-DllCF3mE.js 55.6 kB
packages/frontend/dist/assets/vendor-state-BC0s6PNN.js 22 kB
packages/frontend/dist/assets/vendor-ui-BxUEu4Ht.js 64.2 kB

compressed-size-action

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
packages/frontend/src/components/Layout/Sidebar.test.tsx (1)

415-417: Use String.raw to avoid escaping the backslash.

The escaped \\: in the selector can be simplified using a tagged template literal.

✨ Suggested refactor
         const mobileSidebar = document.querySelector(
-            'aside.fixed.inset-y-0.left-0.z-50.w-64.bg-lucky-bg-secondary.lg\\:hidden',
+            String.raw`aside.fixed.inset-y-0.left-0.z-50.w-64.bg-lucky-bg-secondary.lg\:hidden`,
         )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/frontend/src/components/Layout/Sidebar.test.tsx` around lines 415 -
417, The selector string passed to document.querySelector in the mobileSidebar
assignment currently escapes the colon with `\\:`, which is unnecessary; replace
the plain string with a raw template using String.raw to avoid backslash
escaping (e.g., use String.raw`...` for the selector) so the `lg\:` segment is
written as `lg\:` without double-escaping; update the expression where
mobileSidebar is assigned (the document.querySelector call) accordingly.
packages/frontend/src/components/Dashboard/ServerCard.test.tsx (1)

76-92: Remove Tailwind class assertions from status badge tests.

Lines 82 and 91 assert CSS utility classes (bg-lucky-success/10, bg-lucky-error/10), making tests brittle to styling-only refactors. The tests already verify behavior through accessible labels and text content—keep those; remove the class checks.

♻️ Suggested test hardening
     test('shows active badge when bot is in server', () => {
         renderCard(mockGuild)

         const badge = screen.getByLabelText('Bot installed')
         expect(badge).toBeInTheDocument()
         expect(screen.getByText(/bot active/i)).toBeInTheDocument()
-        expect(badge).toHaveClass('bg-lucky-success/10')
     })

     test('shows no bot badge when bot is not in server', () => {
         renderCard(mockGuildWithoutBot)

         const badge = screen.getByLabelText('Bot not installed')
         expect(badge).toBeInTheDocument()
         expect(screen.getByText(/no bot/i)).toBeInTheDocument()
-        expect(badge).toHaveClass('bg-lucky-error/10')
     })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/frontend/src/components/Dashboard/ServerCard.test.tsx` around lines
76 - 92, The tests "shows active badge when bot is in server" and "shows no bot
badge when bot is not in server" in ServerCard.test.tsx are asserting Tailwind
CSS classes on the status badge (the
expect(badge).toHaveClass('bg-lucky-success/10') and
expect(badge).toHaveClass('bg-lucky-error/10') checks), which is brittle; remove
those two class assertions and keep the existing accessibility and text
assertions (the badge variable obtained via screen.getByLabelText and the
screen.getByText checks) so renderCard, mockGuild, and mockGuildWithoutBot
remain validated by label/text only.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/frontend/src/components/Dashboard/ServerCard.test.tsx`:
- Around line 76-92: The tests "shows active badge when bot is in server" and
"shows no bot badge when bot is not in server" in ServerCard.test.tsx are
asserting Tailwind CSS classes on the status badge (the
expect(badge).toHaveClass('bg-lucky-success/10') and
expect(badge).toHaveClass('bg-lucky-error/10') checks), which is brittle; remove
those two class assertions and keep the existing accessibility and text
assertions (the badge variable obtained via screen.getByLabelText and the
screen.getByText checks) so renderCard, mockGuild, and mockGuildWithoutBot
remain validated by label/text only.

In `@packages/frontend/src/components/Layout/Sidebar.test.tsx`:
- Around line 415-417: The selector string passed to document.querySelector in
the mobileSidebar assignment currently escapes the colon with `\\:`, which is
unnecessary; replace the plain string with a raw template using String.raw to
avoid backslash escaping (e.g., use String.raw`...` for the selector) so the
`lg\:` segment is written as `lg\:` without double-escaping; update the
expression where mobileSidebar is assigned (the document.querySelector call)
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4259e5d1-1a32-47a5-a3d3-69da00341594

📥 Commits

Reviewing files that changed from the base of the PR and between a5d63c3 and a0380b7.

📒 Files selected for processing (3)
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
📜 Review details
⏰ 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). (3)
  • GitHub Check: SonarCloud Scan
  • GitHub Check: Quality Gates
  • GitHub Check: compressed-size
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{js,jsx,ts,tsx,vue,html}

📄 CodeRabbit inference engine (.cursor/rules/accessibility-openness.mdc)

Provide accessible UI components using semantic HTML and ARIA attributes where necessary

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/dependency-injection.mdc)

**/*.{ts,tsx,js,jsx}: Prefer constructor injection for classes that require dependencies
Avoid global mutable singletons unless necessary
Use explicit interfaces for external dependencies to make testing easier

**/*.{ts,tsx,js,jsx}: Include required references in PRs/code for non-trivial logic: TypeScript (official docs), MDN (JavaScript reference), and official docs for any runtime/framework/libraries used (e.g., Node.js, React) as applicable.
Before assuming behavior of an API, include the doc link and a ≤25-word quote when the change relies on it.

**/*.{ts,tsx,js,jsx}: Prefer named exports for clear usage and easier refactors in TypeScript/JavaScript
Keep import order consistent: external first, then internal modules
Remove dead code and unused imports

**/*.{ts,tsx,js,jsx}: Use PascalCase naming convention for React/UI components
Use camelCase naming convention for variables and functions
Use UPPER_SNAKE_CASE naming convention for constants
Maintain consistent import grouping and ordering within the project, keeping third-party imports separate from local imports
For external data sources (HTTP, database), always validate and sanitize input using type guards or schema validators

**/*.{ts,tsx,js,jsx}: Use Prettier with no semicolons, single quotes, 4-space indent, 80 character width
Files must not exceed 250 lines and this is enforced

Implement TypeScript typecheck and linter in CI quality checks

**/*.{ts,tsx,js,jsx}: Use TypeScript for enhanced type safety
Implement error handling and error logging
Avoid commenting code unless extremely necessary - code should explain itself with descriptive names
Leave NO todos, placeholders or missing pieces in the code
Variables and functions must use camelCase
Constants must use UPPER_SNAKE_CASE
Use arrow functions for methods and computed properties
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
Maintain consistent import grouping/order: external imports first, then...

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{js,jsx,ts,tsx}: Never throw strings. Throw Error (or typed subclasses) with descriptive messages
Include causal error as cause when available for better debugging
Define clear, stable error codes (e.g., ERR_AUTH_EXPIRED, ERR_NETWORK_TIMEOUT)
Provide optional metadata (e.g., details, retryable, status, correlationId) in error objects
Use domain error classes per area (e.g., AuthenticationError, ValidationError, NetworkError)
Log errors with structure (message, code, stack, cause, correlationId, user context where appropriate)
Mark retryable vs nonRetryable errors where helpful for operations
Set timeouts and handle aborts/cancellations; avoid dangling requests in API/network code
Implement backoff for transient failures; avoid infinite retries
Map HTTP status → domain errors; 4xx vs 5xx behave differently (e.g., retry for 5xx/network)

**/*.{js,jsx,ts,tsx}: Use functional components with hooks in React/React Native. Avoid class components.
Keep components focused on a single responsibility; extract complex logic into custom hooks.
Keep state local when possible. Use Context/Zustand/Redux only when necessary for state management.
If props or state traverse more than 3 levels, consider using context or a feature-scoped store instead of prop drilling.
Use performance optimization techniques: React.memo, useMemo, useCallback, Suspense (web), and virtualization for long lists; avoid unnecessary re-renders.
Web accessibility: use semantic HTML, labels, focus management, keyboard navigation, and aria-* attributes as needed.
React Native accessibility: use accessibility props (accessible, accessibilityLabel), proper roles and labels.
Identify and extract repetitive UI components proactively to components/ with clear props and minimal coupling.
Web styles: prefer co-located styles or design system tokens; avoid global style leakage.
React Native styles: prefer StyleSheet.create, design tokens, and theme providers; avoid in...

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{jsx,tsx}: Use toasts/snackbars for transient errors; avoid blocking modals for non-critical issues in React/React Native UI
Debounce/suppress duplicate toasts to prevent spam
Provide retry/refresh actions when meaningful (e.g., network failure) in error UI
Use error boundaries for render-time exceptions; show fallback UI in React
Respect accessibility: toasts should be announced (aria-live on web; accessibility hints on React Native)

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

**/*.{test,spec}.{js,jsx,ts,tsx}: Test behavior, not implementation. Prefer Testing Library utilities for testing React/React Native components.
For React Native tests: mock native modules and test component interactions and accessibility labels.

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/pattern.mdc)

Introduce interfaces at module boundaries to enable testing and substitutions

**/*.{ts,tsx}: Avoid using any type in TypeScript. If unavoidable, use unknown with type guards and justify with a code comment
Prefer interface for defining public object shapes in TypeScript, use type for unions and utility types
Use TypeScript utility types such as Partial, Pick, Omit, Readonly, and Record when appropriate
Use I{Name} naming convention for interfaces in TypeScript
Use T{Name} naming convention for type aliases and utility types in TypeScript

**/*.{ts,tsx}: Functions must be less than 50 lines with cyclomatic complexity less than 10
Do not use any types - ESLint enforces this at error level

**/*.{ts,tsx}: Prefer types over interfaces for most cases
Don't ever use any - type safety always
Avoid enums; use const objects instead
For complex types, create a separate file to declare them and import them
Avoid using any type; if unavoidable, use unknown with type guards and justify with code comment
Prefer interface for public API shapes; use type for unions and utility types
Use TypeScript utility types (Partial, Pick, Omit, Readonly, Record)

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/pattern.mdc)

**/*.{test,spec}.{ts,tsx,js,jsx}: Test behavior, not implementation details
Prefer unit tests for core logic; add integration tests at meaningful boundaries

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/testing-quality.mdc)

**/*.{test,spec}.{js,ts,jsx,tsx}: Use Jest + a React testing library for unit and component tests as applicable
Test behavior, not implementation details

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
packages/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/frontend/src/**/*.{ts,tsx}: Frontend errors are created by Axios interceptor and should be of type ApiError with status and details from backend
Frontend uses path alias @/ mapped to src/ - use this alias for all imports from the src directory

Do not depend on @lucky/shared package in frontend code; make API calls to backend via configured base URL (env)

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/documentation.mdc)

**/*.{js,ts,tsx,jsx}: Minimize comments in code; explain the 'why' when non-obvious, let code express the 'what' through clear naming
Document trade-offs briefly when deviating from ideal patterns

**/*.{js,ts,tsx,jsx}: Store secrets, ports, and hosts in environment variables (.env, .env.example) and never hardcode them
Avoid redundant or decorative AI comments; code should be self-explanatory and only commented when logic is non-obvious; prefer refactoring over lengthy comments

Never hardcode secrets, IPs, or ports; use .env and docs/ for required configuration variables

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
packages/frontend/src/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/lucky-frontend.mdc)

Organize UI components in packages/frontend/src/components/ directory

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
packages/frontend/src/{components,pages}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/lucky-frontend.mdc)

Use React functional components and hooks; keep components small and focused

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
packages/frontend/src/{components,pages}/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/lucky-frontend.mdc)

Follow existing styling approach (e.g., Tailwind if present); avoid inline styles for layout and theming

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
packages/frontend/**

📄 CodeRabbit inference engine (.cursor/rules/lucky-project.mdc)

The frontend package uses React with Vite and must not depend on the shared package

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/*.{spec,test}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/quality.mdc)

**/*.{spec,test}.{ts,tsx,js,jsx}: Use Jest for unit and integration tests
Test behavior, not implementation details
Run unit, integration tests, and coverage report in CI quality checks

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
**/[A-Z]*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

Components must use PascalCase naming

Files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-frontend.mdc:0-0
Timestamp: 2026-03-09T20:21:58.991Z
Learning: Write unit and integration tests in `packages/frontend/tests`; use Playwright for E2E tests when changing user flows
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-project.mdc:0-0
Timestamp: 2026-03-09T20:21:08.612Z
Learning: Applies to {packages/*/tests/**/*.test.{js,ts},tests/**/*.test.{js,ts}} : Add or adjust unit and integration tests when changing behavior; follow existing patterns in `packages/*/tests` and root `tests/` directories
📚 Learning: 2026-03-09T20:21:08.612Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-project.mdc:0-0
Timestamp: 2026-03-09T20:21:08.612Z
Learning: Applies to {packages/*/tests/**/*.test.{js,ts},tests/**/*.test.{js,ts}} : Add or adjust unit and integration tests when changing behavior; follow existing patterns in `packages/*/tests` and root `tests/` directories

Applied to files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
📚 Learning: 2026-03-09T20:21:31.459Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/quality.mdc:0-0
Timestamp: 2026-03-09T20:21:31.459Z
Learning: Applies to **/*.{spec,test}.{ts,tsx,js,jsx} : Test behavior, not implementation details

Applied to files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
📚 Learning: 2026-03-09T20:20:56.356Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-frontend.mdc:0-0
Timestamp: 2026-03-09T20:20:56.356Z
Learning: Applies to packages/frontend/tests/**/*.{ts,tsx,js} : Write tests in `packages/frontend/tests/` using existing test patterns (e.g., Playwright for e2e if configured)

Applied to files:

  • packages/frontend/src/components/Layout/Layout.test.tsx
📚 Learning: 2026-03-09T20:21:31.459Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/quality.mdc:0-0
Timestamp: 2026-03-09T20:21:31.459Z
Learning: Applies to tests/**/*.test.{ts,tsx,js,jsx} : Add integration tests where appropriate

Applied to files:

  • packages/frontend/src/components/Layout/Sidebar.test.tsx
  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
📚 Learning: 2026-03-09T20:20:38.694Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-backend-api.mdc:0-0
Timestamp: 2026-03-09T20:20:38.694Z
Learning: Applies to packages/backend/tests/**/*.{ts,tsx} : Organize tests in `packages/backend/tests/` with unit tests under `unit/` and integration tests under `integration/`, following existing patterns with fixtures and setup

Applied to files:

  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
📚 Learning: 2026-03-09T20:21:38.098Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-backend.mdc:0-0
Timestamp: 2026-03-09T20:21:38.098Z
Learning: Applies to packages/backend/tests/**/*.ts : Follow existing patterns for unit and integration tests in `packages/backend/tests/`

Applied to files:

  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
📚 Learning: 2026-03-09T20:21:58.991Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-frontend.mdc:0-0
Timestamp: 2026-03-09T20:21:58.991Z
Learning: Write unit and integration tests in `packages/frontend/tests`; use Playwright for E2E tests when changing user flows

Applied to files:

  • packages/frontend/src/components/Dashboard/ServerCard.test.tsx
🪛 GitHub Check: SonarCloud Code Analysis
packages/frontend/src/components/Layout/Sidebar.test.tsx

[warning] 416-416: String.raw should be used to avoid escaping \.

See more on https://sonarcloud.io/project/issues?id=LucasSantana-Dev_Nexus&issues=AZ0rz4qWFd_qGgbzfEha&open=AZ0rz4qWFd_qGgbzfEha&pullRequest=366

🔇 Additional comments (11)
packages/frontend/src/components/Layout/Layout.test.tsx (2)

52-56: Nice upgrade to an accessibility-first assertion.

Using role + accessible name on Line 53 makes this test behavior-focused and aligned with the actual interactive control.

Based on learnings: "Applies to **/*.{spec,test}.{ts,tsx,js,jsx} : Test behavior, not implementation details".


95-97: Good negative-path coverage for no selected guild.

The Line 96 role-based absence check is a solid regression guard for the fallback route behavior.

Based on learnings: "Applies to **/*.{spec,test}.{ts,tsx,js,jsx} : Test behavior, not implementation details".

packages/frontend/src/components/Layout/Sidebar.test.tsx (4)

117-118: LGTM! Good shift to accessibility-based assertions.

Using aria-current="page" aligns with the WAI-ARIA standard for indicating the current page in navigation, and the test now correctly reflects the component's implementation.


165-165: LGTM!

The selector correctly matches the component's aria-label='Log out' (two words) as confirmed in the Sidebar implementation.


404-406: LGTM!

The accessible name now correctly matches the component's aria-label='Open navigation menu'.


351-394: LGTM! Good coverage for guild automation route access.

The two tests correctly verify:

  1. Guild Automation nav item is hidden when user only has settings: 'view' (even with automation: 'manage')
  2. Guild Automation nav item is shown when user has settings: 'manage'

This aligns with the PR objective and maintains regression coverage for the settings-based access guard.

packages/frontend/src/components/Dashboard/ServerCard.test.tsx (5)

20-47: Mocking setup for useGuildStore is well-aligned with component behavior.

This setup cleanly supports asserting selectGuild side effects in interaction tests.


62-66: Icon accessibility and CDN URL assertions look good.

These assertions correctly reflect rendered behavior (alt text and ?size=128 URL variant).


94-98: Nice addition for member-count rendering coverage.

This strengthens visible-state coverage with a direct user-facing assertion.


107-116: Great interaction test for Manage action side effects.

Asserting both guild selection and navigation improves regression safety for this flow.


122-141: Updated accessibility-focused button/indicator assertions are solid.

The role/label-based checks improve resilience and user-centric coverage for bot-installed vs not-installed states.

@coderabbitai coderabbitai Bot added the ci label Mar 26, 2026
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 6a8f3bc into main Mar 27, 2026
13 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/guild-automation-route-coverage branch March 27, 2026 00:20
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
* test(frontend): cover guild automation route access

* test(frontend): update mobile sidebar label assertion

* test(frontend): align layout and sidebar assertions

* test(frontend): align layout and sidebar assertions

* test(frontend): align server card assertions

* ci(vercel): skip yt-dlp download during install

* test(frontend): align music and server page assertions

* test(frontend): align login and moderation assertions

* test(frontend): align login assertions

This branch was successfully deployed

1 active deployment
Preview — fdcb00f8 Deployed Mar 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant