authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:26:23-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:26:23-07:00
log1e24b43d3f6eea6333a3c8da6946eb614d00a662
treebaa08781b7497aec044ee33c860c1a0b30a48736
parentac93fbfad01ecd99f818d9964463afb6c35a8f4a
signature Signed by PGP key B5690EEEBB952194

refactor(mobile): keep project selection helper private (#9999)


2 files changed, 1 insertions(+), 14 deletions(-)

apps/mobile/src/features/threads/new-task-project-selection.test.ts-13
...@@ -4,7 +4,6 @@ import { describe, expect, it } from "vite-plus/test";...@@ -4,7 +4,6 @@ import { describe, expect, it } from "vite-plus/test";
4import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";4import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
5import type { HomeProjectScope } from "../home/homeThreadList";5import type { HomeProjectScope } from "../home/homeThreadList";
6import {6import {
7 getOnlySelectableProject,
8 getProjectScopeSelectionTarget,7 getProjectScopeSelectionTarget,
9 resolveDraftProjectSelection,8 resolveDraftProjectSelection,
10} from "./new-task-project-selection";9} from "./new-task-project-selection";
...@@ -36,18 +35,6 @@ function makeScope(projects: ReadonlyArray<EnvironmentProject>): HomeProjectScop...@@ -36,18 +35,6 @@ function makeScope(projects: ReadonlyArray<EnvironmentProject>): HomeProjectScop
36 };35 };
37}36}
3837
39describe("getOnlySelectableProject", () => {
40 it("auto-selects when there is exactly one physical project", () => {
41 const project = makeProject("t3code");
42 expect(getOnlySelectableProject([makeScope([project])])).toBe(project);
43 });
44
45 it("selects the representative when one logical project has multiple workspaces", () => {
46 const projects = [makeProject("t3code"), makeProject("t3code-2"), makeProject("t3code-3")];
47 expect(getOnlySelectableProject([makeScope(projects)])).toBe(projects[0]);
48 });
49});
50
51describe("getProjectScopeSelectionTarget", () => {38describe("getProjectScopeSelectionTarget", () => {
52 it("keeps the current environment when it hosts the selected logical project", () => {39 it("keeps the current environment when it hosts the selected logical project", () => {
53 const projects = [makeProject("t3code-mac", "mac"), makeProject("t3code-server", "server")];40 const projects = [makeProject("t3code-mac", "mac"), makeProject("t3code-server", "server")];
apps/mobile/src/features/threads/new-task-project-selection.ts+1-1
...@@ -19,7 +19,7 @@ export function getProjectScopeSelectionTarget(...@@ -19,7 +19,7 @@ export function getProjectScopeSelectionTarget(
19 );19 );
20}20}
2121
22export function getOnlySelectableProject(22function getOnlySelectableProject(
23 projectScopes: ReadonlyArray<HomeProjectScope>,23 projectScopes: ReadonlyArray<HomeProjectScope>,
24): EnvironmentProject | null {24): EnvironmentProject | null {
25 const onlyScope = projectScopes.length === 1 ? projectScopes[0] : null;25 const onlyScope = projectScopes.length === 1 ? projectScopes[0] : null;