Add UI, session and workstore tests#134
Merged
Merged
Conversation
Add several unit tests and a small docs update to improve coverage and validate behavior: - Update AGENTS.md with an Activity entry for 2026-05-24. - Add NativeSwiftUIInterfaceTests asserting SceneStorage, CreateIssueSheet init/state, session launch handling, and session detail terminal UI. - Add SessionLauncherTests covering checkSession outcomes (completed/failed) and include a FakeTmuxController actor to simulate tmux behavior. - Add WorkStoreCRUDTests test for createIssue returning the created item on success. These changes increase confidence around UI wiring, tmux session checks, and issue creation flows.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve confidence/coverage by adding unit tests around UI “contract” behaviors, tmux session status handling, and WorkStore issue creation, plus a small AGENTS.md activity log update.
Changes:
- Add an Activity entry for 2026-05-24 in
AGENTS.md. - Add new tests for WorkStore issue creation return behavior and SessionLauncher session checking.
- Add/extend source-based SwiftUI interface contract tests for repository persistence, create-issue sheet seeding, and terminal UI expectations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| AGENTS.md | Adds an Activity entry for 2026-05-24. |
| AgentBoardTests/WorkStoreCRUDTests.swift | Adds a test asserting createIssue returns the created item. |
| AgentBoardTests/SessionLauncherTests.swift | Adds tests for checkSession interpreting session completion/failure. |
| AgentBoardTests/NativeSwiftUIInterfaceTests.swift | Adds UI contract tests by asserting expected source snippets are present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+89
to
+94
| let created = await store.createIssue( | ||
| repository: ConfiguredRepository(owner: "org", name: "repo"), | ||
| title: "Dismiss sheet", | ||
| body: "Body here" | ||
| ) | ||
|
|
Comment on lines
+130
to
+152
| @Test @MainActor func checkSessionReturnsCompletedWhenPaneShowsSuccessfulExit() async { | ||
| let launcher = SessionLauncher(tmux: FakeTmuxController( | ||
| hasSessionResult: true, | ||
| paneOutput: "work complete\nEXITED: 0" | ||
| )) | ||
| let session = makeActiveSession(name: "ab-agentboard-130") | ||
|
|
||
| let status = await launcher.checkSession(session) | ||
|
|
||
| #expect(status == .completed) | ||
| } | ||
|
|
||
| @Test @MainActor func checkSessionReturnsFailedWhenPaneShowsNonzeroExit() async { | ||
| let launcher = SessionLauncher(tmux: FakeTmuxController( | ||
| hasSessionResult: true, | ||
| paneOutput: "Failed to authenticate\nEXITED: 1" | ||
| )) | ||
| let session = makeActiveSession(name: "ab-agentboard-132") | ||
|
|
||
| let status = await launcher.checkSession(session) | ||
|
|
||
| #expect(status == .failed) | ||
| } |
Comment on lines
+81
to
+89
| @Test func workBoardPersistsSelectedRepositoryAndSeedsCreateIssueSheet() throws { | ||
| let workSource = try Self.source("AgentBoardUI/Screens/WorkScreen.swift") | ||
| let createSource = try Self.source("AgentBoardUI/Screens/CreateIssueSheet.swift") | ||
|
|
||
| #expect(workSource.contains(#"@SceneStorage("work.selectedRepository")"#)) | ||
| #expect(workSource.contains("CreateIssueSheet(initialRepository: selectedCreateRepository)")) | ||
| #expect(workSource.contains("private var selectedCreateRepository: ConfiguredRepository?")) | ||
| #expect(createSource.contains("init(initialRepository: ConfiguredRepository? = nil)")) | ||
| #expect(createSource.contains("_selectedRepository = State(initialValue: initialRepository)")) |
Comment on lines
+92
to
+96
| @Test func launchedSessionsOpenTerminalInDesktopShell() throws { | ||
| let source = try Self.source("AgentBoard/DesktopRootView.swift") | ||
|
|
||
| #expect(source.contains("onChange(of: appModel.sessionLauncher.activeSessions.map(\\.id))")) | ||
| #expect(source.contains("activeSessionTerminal = session")) |
Comment on lines
+99
to
+105
| @Test func companionSessionDetailOffersTerminalWhenTmuxSessionExists() throws { | ||
| let source = try Self.source("AgentBoardUI/Screens/SessionDetailSheet.swift") | ||
|
|
||
| #expect(source.contains("session.tmuxSession")) | ||
| #expect(source.contains(#"Text("Terminal").tag(2)"#)) | ||
| #expect(source.contains("SessionLauncher.attachCommand(for: tmuxSession)")) | ||
| #expect(source.contains("EmbeddedTerminalView(")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add several unit tests and a small docs update to improve coverage and validate behavior:
These changes increase confidence around UI wiring, tmux session checks, and issue creation flows.