diff --git a/frontend/src/app/[locale]/settings/page.test.tsx b/frontend/src/app/[locale]/settings/page.test.tsx
index 7cc6e680..82c54c89 100644
--- a/frontend/src/app/[locale]/settings/page.test.tsx
+++ b/frontend/src/app/[locale]/settings/page.test.tsx
@@ -2,6 +2,17 @@ import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import SettingsPage from "./page";
+const mockReplace = jest.fn();
+
+jest.mock("next-intl", () => ({
+ useLocale: () => "en",
+}));
+
+jest.mock("next/navigation", () => ({
+ useRouter: () => ({ replace: mockReplace }),
+ usePathname: () => "/en/settings",
+}));
+
jest.mock("../../lib/session", () => ({
logoutUser: jest.fn(),
}));
@@ -32,10 +43,21 @@ jest.mock("../../stores/useWalletStore", () => ({
}));
jest.mock("../../stores/useThemeStore", () => ({
- useThemeStore: jest.fn(() => ({
- theme: "system",
- setTheme: jest.fn(),
- })),
+ useThemeStore: jest.fn((selector) =>
+ selector
+ ? selector({
+ theme: "system",
+ hydrated: true,
+ initializeTheme: jest.fn(),
+ setTheme: jest.fn(),
+ })
+ : {
+ theme: "system",
+ hydrated: true,
+ initializeTheme: jest.fn(),
+ setTheme: jest.fn(),
+ },
+ ),
}));
jest.mock("../../hooks/useApi", () => ({
@@ -48,6 +70,10 @@ jest.mock("../../components/gamification/GamificationSettings", () => ({
}));
describe("SettingsPage section navigation", () => {
+ beforeEach(() => {
+ mockReplace.mockClear();
+ });
+
it("exposes the default active section via aria-selected", () => {
render(