(t *testing.T)
| 1998 | } |
| 1999 | |
| 2000 | func TestWorktreeForBranchRejectsNonMatchingBranch(t *testing.T) { |
| 2001 | worktrees := []Worktree{ |
| 2002 | {Path: "/path/to/main", Ref: "refs/heads/main"}, |
| 2003 | {Path: "/path/to/feature", Ref: "refs/heads/feature/one"}, |
| 2004 | } |
| 2005 | tests := []struct { |
| 2006 | name string |
| 2007 | branch string |
| 2008 | }{ |
| 2009 | {name: "partial branch name", branch: "feature"}, |
| 2010 | {name: "missing branch", branch: "missing"}, |
| 2011 | } |
| 2012 | |
| 2013 | for _, tt := range tests { |
| 2014 | t.Run(tt.name, func(t *testing.T) { |
| 2015 | // Given worktrees without the exact requested branch |
| 2016 | branch := tt.branch |
| 2017 | |
| 2018 | // When the branch is located |
| 2019 | worktree := WorktreeForBranch(worktrees, branch) |
| 2020 | |
| 2021 | // Then no worktree is returned |
| 2022 | assert.Nil(t, worktree) |
| 2023 | }) |
| 2024 | } |
| 2025 | } |
| 2026 | |
| 2027 | func TestClientWorktreesListsRepositoryWorktrees(t *testing.T) { |
| 2028 | // Given a repository with a linked feature worktree |
nothing calls this directly
no test coverage detected