From 133db9418427fc7e4970e7ca4b8f930dc8858c29 Mon Sep 17 00:00:00 2001 From: MikotoZero Date: Mon, 15 Jun 2026 15:44:43 +0800 Subject: [PATCH] Fix workspace prompt path tests --- .../AppFeatureCommandPaletteTests.swift | 12 +++++-- supacodeTests/RepositoriesFeatureTests.swift | 36 ++++++++++++++----- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/supacodeTests/AppFeatureCommandPaletteTests.swift b/supacodeTests/AppFeatureCommandPaletteTests.swift index 796fab14..53efde3d 100644 --- a/supacodeTests/AppFeatureCommandPaletteTests.swift +++ b/supacodeTests/AppFeatureCommandPaletteTests.swift @@ -375,16 +375,22 @@ struct AppFeatureCommandPaletteTests { } let title = "Workspace" + let requestedRootPath = defaultWorkspaceBaseRootPath(for: title) + let resolvedRootPath = expectedDefaultWorkspaceRootPath(for: title) await store.send(.commandPalette(.delegate(.newWorkspace))) await store.receive(\.repositories.workspaceCreation.promptRequested) { $0.repositories.workspaceCreationPrompt = WorkspaceCreationPromptFeature.State( repositories: [], title: title, - rootPath: defaultWorkspaceBaseRootPath(for: title) + rootPath: requestedRootPath ) } - await store.receive(\.repositories.workspaceCreation.defaultRootPathResolved) { - $0.repositories.workspaceCreationPrompt?.rootPath = expectedDefaultWorkspaceRootPath(for: title) + if resolvedRootPath == requestedRootPath { + await store.receive(\.repositories.workspaceCreation.defaultRootPathResolved) + } else { + await store.receive(\.repositories.workspaceCreation.defaultRootPathResolved) { + $0.repositories.workspaceCreationPrompt?.rootPath = resolvedRootPath + } } } diff --git a/supacodeTests/RepositoriesFeatureTests.swift b/supacodeTests/RepositoriesFeatureTests.swift index 7989d8c9..6ebb1a9b 100644 --- a/supacodeTests/RepositoriesFeatureTests.swift +++ b/supacodeTests/RepositoriesFeatureTests.swift @@ -589,11 +589,13 @@ struct RepositoriesFeatureTests { } let title = "Workspace" + let requestedRootPath = defaultWorkspaceBaseRootPath(for: title) + let resolvedRootPath = expectedDefaultWorkspaceRootPath(for: title) await store.send(.workspaceCreation(.promptRequested)) { $0.workspaceCreationPrompt = WorkspaceCreationPromptFeature.State( repositories: [], title: title, - rootPath: defaultWorkspaceBaseRootPath(for: title), + rootPath: requestedRootPath, openedRepositoryCandidates: [ ProjectWorkspaceCreationRepository( id: "/tmp/repo-a", @@ -603,8 +605,12 @@ struct RepositoriesFeatureTests { ] ) } - await store.receive(\.workspaceCreation.defaultRootPathResolved) { - $0.workspaceCreationPrompt?.rootPath = expectedDefaultWorkspaceRootPath(for: title) + if resolvedRootPath == requestedRootPath { + await store.receive(\.workspaceCreation.defaultRootPathResolved) + } else { + await store.receive(\.workspaceCreation.defaultRootPathResolved) { + $0.workspaceCreationPrompt?.rootPath = resolvedRootPath + } } } @@ -701,11 +707,13 @@ struct RepositoriesFeatureTests { } let title = "Workspace" + let requestedRootPath = defaultWorkspaceBaseRootPath(for: title) + let resolvedRootPath = expectedDefaultWorkspaceRootPath(for: title) await store.send(.workspaceCreation(.promptRequested)) { $0.workspaceCreationPrompt = WorkspaceCreationPromptFeature.State( repositories: [], title: title, - rootPath: defaultWorkspaceBaseRootPath(for: title), + rootPath: requestedRootPath, openedRepositoryCandidates: [ ProjectWorkspaceCreationRepository( id: repoRootA, @@ -720,8 +728,12 @@ struct RepositoriesFeatureTests { ] ) } - await store.receive(\.workspaceCreation.defaultRootPathResolved) { - $0.workspaceCreationPrompt?.rootPath = expectedDefaultWorkspaceRootPath(for: title) + if resolvedRootPath == requestedRootPath { + await store.receive(\.workspaceCreation.defaultRootPathResolved) + } else { + await store.receive(\.workspaceCreation.defaultRootPathResolved) { + $0.workspaceCreationPrompt?.rootPath = resolvedRootPath + } } } @@ -755,11 +767,13 @@ struct RepositoriesFeatureTests { } let title = "Workspace" + let requestedRootPath = defaultWorkspaceBaseRootPath(for: title) + let resolvedRootPath = expectedDefaultWorkspaceRootPath(for: title) await store.send(.workspaceCreation(.promptRequested)) { $0.workspaceCreationPrompt = WorkspaceCreationPromptFeature.State( repositories: [], title: title, - rootPath: defaultWorkspaceBaseRootPath(for: title), + rootPath: requestedRootPath, openedRepositoryCandidates: [ ProjectWorkspaceCreationRepository( id: repoRootA, @@ -774,8 +788,12 @@ struct RepositoriesFeatureTests { ] ) } - await store.receive(\.workspaceCreation.defaultRootPathResolved) { - $0.workspaceCreationPrompt?.rootPath = expectedDefaultWorkspaceRootPath(for: title) + if resolvedRootPath == requestedRootPath { + await store.receive(\.workspaceCreation.defaultRootPathResolved) + } else { + await store.receive(\.workspaceCreation.defaultRootPathResolved) { + $0.workspaceCreationPrompt?.rootPath = resolvedRootPath + } } await store.send(.workspaceCreationPrompt(.presented(.addOpenedRepository(repoRootA)))) { $0.workspaceCreationPrompt?.repositories.append( -- 2.51.2