- ,
- );
-
- expect(screen.getByTestId('sidebar')).not.toHaveAttribute('data-selected-nav-id', 'dids');
- });
+ it('redirects to sign-in when unauthenticated', () => {
+ mockUseAuth.mockReturnValue({
+ user: null,
+ isLoading: false,
+ isAuthenticated: false,
+ logout: jest.fn(),
+ });
- it('matches sub-paths to the correct nav item', () => {
- mockPathname.mockReturnValue('/configuration/dids/create');
render(
-
Content
+
Content
,
);
- expect(screen.getByTestId('sidebar')).toHaveAttribute('data-selected-nav-id', 'dids');
+ expect(mockPush).toHaveBeenCalledWith('/api/auth/signin');
+ expect(screen.getByTestId('loader')).toBeInTheDocument();
+ expect(screen.queryByTestId('content')).toBeNull();
});
});
diff --git a/packages/reference-implementation/src/app/(protected)/layout.tsx b/packages/reference-implementation/src/app/(protected)/layout.tsx
index adbb4648e..e7a73b170 100644
--- a/packages/reference-implementation/src/app/(protected)/layout.tsx
+++ b/packages/reference-implementation/src/app/(protected)/layout.tsx
@@ -8,6 +8,9 @@ import { DidProvider } from '@/contexts/did/DidContext';
import { Sidebar, MobileSidebar } from '@/components/sidebar';
import { LogOut } from 'lucide-react';
+// Navigation is hidden until the pages it links to exist; flip to true to reinstate (#715).
+const SHOW_NAVIGATION = false;
+
interface ProtectedLayoutProps {
children: React.ReactNode;
}
@@ -144,17 +147,21 @@ function ProtectedContent({ children }: { children: React.ReactNode }) {
return (
- {/* Mobile Sidebar/Navbar - hidden on desktop */}
-
-
-
-
- {/* Desktop Sidebar - hidden on mobile */}
-
-
-
-
-
+ {SHOW_NAVIGATION && (
+ <>
+ {/* Mobile Sidebar/Navbar - hidden on desktop */}
+
+
+
+
+ {/* Desktop Sidebar - hidden on mobile */}
+
+
+
+ >
+ )}
+
+
{isLoading ? (
diff --git a/packages/reference-implementation/src/app/(public)/layout.test.tsx b/packages/reference-implementation/src/app/(public)/layout.test.tsx
new file mode 100644
index 000000000..5b56c6dc7
--- /dev/null
+++ b/packages/reference-implementation/src/app/(public)/layout.test.tsx
@@ -0,0 +1,36 @@
+import { render, screen } from '@testing-library/react';
+import PublicLayout from './layout';
+
+// Mocked with a root test id so the absence assertion trips if the layout
+// renders the Header again (the real Header has no test id on its root). See #715.
+jest.mock('@/components/Header/Header', () => ({
+ __esModule: true,
+ default: () => ,
+}));
+
+jest.mock('@reference-implementation/components', () => ({
+ Footer: () => ,
+}));
+
+describe('PublicLayout', () => {
+ it('renders children without the header', () => {
+ render(
+
+