-
Notifications
You must be signed in to change notification settings - Fork 111
fix(mobile): distinguish worktrees in repo quick switch sheet by branch #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -110,6 +110,53 @@ describe('RepoQuickSwitchSheet', () => { | |||||||||||||||
| }) | ||||||||||||||||
| }) | ||||||||||||||||
|
|
||||||||||||||||
| it('distinguishes worktrees of the same repo by branch', async () => { | ||||||||||||||||
| vi.mocked(listRepos).mockResolvedValue([ | ||||||||||||||||
| { | ||||||||||||||||
| id: 1, | ||||||||||||||||
| repoUrl: 'https://github.com/test/repo1.git', | ||||||||||||||||
| localPath: '/path/to/repo1', | ||||||||||||||||
| sourcePath: null, | ||||||||||||||||
| currentBranch: 'main', | ||||||||||||||||
| isLocal: false, | ||||||||||||||||
| createdAt: new Date().toISOString(), | ||||||||||||||||
| updatedAt: new Date().toISOString(), | ||||||||||||||||
| }, | ||||||||||||||||
| { | ||||||||||||||||
| id: 2, | ||||||||||||||||
| repoUrl: 'https://github.com/test/repo1.git', | ||||||||||||||||
| localPath: '/path/to/repo1/.worktrees/feature-a', | ||||||||||||||||
| sourcePath: null, | ||||||||||||||||
| currentBranch: 'feature-a', | ||||||||||||||||
| isWorktree: true, | ||||||||||||||||
| isLocal: false, | ||||||||||||||||
| createdAt: new Date().toISOString(), | ||||||||||||||||
| updatedAt: new Date().toISOString(), | ||||||||||||||||
| }, | ||||||||||||||||
| { | ||||||||||||||||
| id: 3, | ||||||||||||||||
| repoUrl: 'https://github.com/test/repo1.git', | ||||||||||||||||
| localPath: '/path/to/repo1/.worktrees/feature-b', | ||||||||||||||||
| sourcePath: null, | ||||||||||||||||
| currentBranch: 'feature-b', | ||||||||||||||||
| isWorktree: true, | ||||||||||||||||
| isLocal: false, | ||||||||||||||||
| createdAt: new Date().toISOString(), | ||||||||||||||||
| updatedAt: new Date().toISOString(), | ||||||||||||||||
| }, | ||||||||||||||||
| ]) | ||||||||||||||||
| const handleClose = vi.fn() | ||||||||||||||||
| render( | ||||||||||||||||
| <RepoQuickSwitchSheet isOpen onClose={handleClose} />, | ||||||||||||||||
| { wrapper: createWrapper() }, | ||||||||||||||||
| ) | ||||||||||||||||
| await waitFor(() => { | ||||||||||||||||
| expect(screen.getAllByText('repo1')).toHaveLength(3) | ||||||||||||||||
| expect(screen.getByText('feature-a')).toBeInTheDocument() | ||||||||||||||||
| expect(screen.getByText('feature-b')).toBeInTheDocument() | ||||||||||||||||
|
Comment on lines
+154
to
+156
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert the parent repository branch label. The test verifies three repository rows and the two worktree labels. It passes if the parent repository label Proposed test update await waitFor(() => {
expect(screen.getAllByText('repo1')).toHaveLength(3)
+ expect(screen.getByText('main')).toBeInTheDocument()
expect(screen.getByText('feature-a')).toBeInTheDocument()
expect(screen.getByText('feature-b')).toBeInTheDocument()
})📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| }) | ||||||||||||||||
| }) | ||||||||||||||||
|
|
||||||||||||||||
| it('does not show assistant as a repo option', async () => { | ||||||||||||||||
| vi.mocked(listRepos).mockResolvedValue([ | ||||||||||||||||
| { | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: chriswritescode-dev/opencode-manager
Length of output: 50392
🏁 Script executed:
Repository: chriswritescode-dev/opencode-manager
Length of output: 4745
Make the mocked value conform to
Repo.listReposreturnsPromise<Repo[]>, but these mock objects omit required fields and setsourcePathtonullinstead ofstringorundefined. Add the required fields or use a typed mock factory. The test is excluded fromfrontend/tsconfig.app.json, so strict type checking does not currently catch this mismatch.🤖 Prompt for AI Agents
Source: Coding guidelines