Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test([issue-939]): address claude review — stable testid scoping + prove unknown-path filter

Adam Eivye60de4a2fd39
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 3d0291e245..ee07e84a86 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -993,7 +993,7 @@ export default function Layout() {
{!collapsed && (pinned.length > 0 || recent.length > 0) && (
<div className="mb-2">
{pinned.length > 0 && (
- <div className="mb-2">
+ <div className="mb-2" data-testid="pinned-section">
<div className="px-4 py-1 text-[10px] font-semibold uppercase tracking-wide text-gray-500">Pinned</div>
{pinned.map((entry) => (
<WorkingSetRow key={`pin-${entry.path}`} entry={entry} pinned onTogglePin={() => unpin(entry.path)} onNavigate={() => setMobileOpen(false)} isActive={entry.end ? location.pathname === entry.path : isActive(entry.path)} />
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsx
index 4dec978f4d..a9c79ce648 100644
--- a/client/src/components/Layout.test.jsx
+++ b/client/src/components/Layout.test.jsx
@@ -67,12 +67,10 @@ const renderLayout = (initialPath = '/brain/inbox') =>
</MemoryRouter>,
);
-// Find the "Pinned" section heading and return its container so assertions are
-// scoped to the Pinned region (the same label also exists in the main nav tree).
-const pinnedSection = () => {
- const heading = screen.getByText('Pinned');
- return heading.parentElement;
-};
+// The Pinned region carries a stable `data-testid` so assertions scope to it
+// without depending on the heading's DOM nesting (a benign style refactor of the
+// label shouldn't break these tests). Returns null when the section isn't rendered.
+const pinnedSection = () => screen.queryByTestId('pinned-section');
beforeEach(() => {
localStorage.clear();
@@ -111,14 +109,21 @@ describe('Layout — pinned single nav rows', () => {
it('omits the Pinned section entirely when nothing is pinned', () => {
renderLayout();
- expect(screen.queryByText('Pinned')).toBeNull();
+ expect(pinnedSection()).toBeNull();
});
- it('does not surface an unknown pinned path (filtered by resolveNavEntry)', () => {
+ it('filters out an unknown pinned path while keeping the known one', () => {
// A stored path that maps to no nav leaf and no manifest entry resolves to
- // null and is dropped — so the Pinned section never renders for it alone.
- localStorage.setItem(PINNED_KEY, JSON.stringify(['/this/path/does/not/exist']));
+ // null and is dropped by resolveNavEntry; a known path beside it still renders.
+ // Asserting the survivor (not just absence) proves the filter, not merely that
+ // the section failed to render.
+ localStorage.setItem(PINNED_KEY, JSON.stringify(['/this/path/does/not/exist', '/city']));
renderLayout();
- expect(screen.queryByText('Pinned')).toBeNull();
+
+ const pinned = pinnedSection();
+ expect(pinned).toBeTruthy();
+ expect(within(pinned).getByRole('link', { name: /City/i })).toHaveAttribute('href', '/city');
+ // The unknown path contributes no row.
+ expect(within(pinned).getAllByRole('link')).toHaveLength(1);
});
});