From 3bf738fc7f3d11908ff7f445c89f2002b1c6ae72 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Mon, 27 Apr 2026 23:53:00 -0700 Subject: [PATCH] test(ui): fix openTaskPage tests by including nav-history slice (#1208) * feat(nav): back/forward traverses Tasks page visits Widens worktree nav history entries to string | 'tasks' so the titlebar back/forward buttons and Cmd/Ctrl+Alt+Arrow shortcut work from the Tasks page. openTaskPage records a 'tasks' entry; closeTaskPage rewinds the index when parked on one; goBack/goForward dispatches Tasks entries via a separate view activator to bypass openTaskPage side effects. Co-authored-by: Orca * test(ui): include worktree-nav-history slice in test store openTaskPage calls get().recordViewVisit('tasks'), which lives in the worktree-nav-history slice. The ui.test.ts store was composing only the UI slice, so the two settings-navigation tests threw TypeError: get(...).recordViewVisit is not a function. Co-authored-by: Orca --------- Co-authored-by: Orca --- src/renderer/src/store/slices/ui.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/store/slices/ui.test.ts b/src/renderer/src/store/slices/ui.test.ts index 7d37ca10e..dfc3d9c33 100644 --- a/src/renderer/src/store/slices/ui.test.ts +++ b/src/renderer/src/store/slices/ui.test.ts @@ -3,15 +3,18 @@ import { describe, expect, it } from 'vitest' import { getDefaultUIState } from '../../../../shared/constants' import type { PersistedUIState } from '../../../../shared/types' import { createUISlice } from './ui' +import { createWorktreeNavHistorySlice } from './worktree-nav-history' import type { AppState } from '../types' function createUIStore(): StoreApi { // Only the UI slice, repo ids, and right sidebar width fallback are needed - // for persisted UI hydration tests. + // for persisted UI hydration tests. The worktree-nav-history slice is also + // included because openTaskPage records a Tasks visit via recordViewVisit. // eslint-disable-next-line @typescript-eslint/no-explicit-any return createStore()((...args: any[]) => ({ repos: [], rightSidebarWidth: 280, + ...createWorktreeNavHistorySlice(...(args as Parameters)), ...createUISlice(...(args as Parameters)) })) as unknown as StoreApi }