test(layout): add sidebar/topbar tests and remove misnamed middleware.tsx - #1376
Merged
yusuftomilola merged 1 commit intoAug 26, 2026
Conversation
….tsx - Add sidebar.test.tsx: navigation rendering, active-route highlighting, logout button, Settings/Notifications links, logo text (5 tests) - Add topbar.test.tsx: page title, user initials/name/role, dropdown toggle, logout redirect, wallet button, hamburger menu click (7 tests) - Delete frontend/components/middleware.tsx: unused duplicate Sidebar component; the real Sidebar lives in layout/sidebar.tsx and the real Next.js middleware is at frontend/middleware.ts Closes DistinctCodes#1303
|
@dzekojohn4 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@dzekojohn4 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
yusuftomilola
approved these changes
Aug 26, 2026
yusuftomilola
left a comment
Collaborator
There was a problem hiding this comment.
No merge conflicts with main. Sidebar/topbar tests plus removing the misnamed middleware.tsx is a good cleanup - approving.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1303
Closes #1300
Closes #1301
Closes #1302
Adds unit tests for the
SidebarandTopbarlayout components (12 tests total) and deletes the unusedfrontend/components/middleware.tsxfile — a misnamed duplicate of the real Sidebar that confused file search results.Why
sidebar.tsxandtopbar.tsximplement the app's primary navigation chrome with no test coverage. The Sidebar component's active-route highlighting and logout flow are critical UX behaviors that should be verified. Separately,frontend/components/middleware.tsxexported aSidebarcomponent but was never imported anywhere — it is a stale duplicate oflayout/sidebar.tsx. Its filename reads as Next.js route-protection middleware but contains none; the real middleware isfrontend/middleware.tsat the project root. This caused confusion when searching for "middleware" in the codebase.What was built
frontend/components/layout/sidebar.test.tsx:aria-current="page"set on active route linkuseAuthStore.logout()androuter.push("/login")frontend/components/layout/topbar.test.tsx:logout()and redirects to/loginWalletButtoncomponent rendersonMenuClickcallback fires on clickDeleted files:
frontend/components/middleware.tsx— unused duplicate oflayout/sidebar.tsx; not imported by any file in the projectIntegration changes outside
layout/frontend/components/middleware.tsx— deleted. Not imported by any file; the real Sidebar is atlayout/sidebar.tsx(imported byapp/(dashboard)/layout.tsx), and the real Next.js middleware isfrontend/middleware.ts.Acceptance criteria coverage
aria-current, logout + redirect)middleware.tsxexists outside the real Next.jsfrontend/middleware.ts(deleted)Test plan
npm testinfrontend/— 12/12 passing (all new tests for this feature)Env vars / Notes
No new environment variables. Tests mock
next/navigation,@/store/auth.store,@/components/wallet/wallet-button, and@/lib/theme-providerusingjest.mock().