MCPcopy
hub / github.com/cli/cli / Test_formatCodespacesForSelect

Function Test_formatCodespacesForSelect

pkg/cmd/codespace/common_test.go:141–296  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func Test_formatCodespacesForSelect(t *testing.T) {
142 type args struct {
143 codespaces []*api.Codespace
144 }
145 tests := []struct {
146 name string
147 args args
148 wantCodespacesNames []string
149 }{
150 {
151 name: "One codespace: Shows only repo and branch name",
152 args: args{
153 codespaces: []*api.Codespace{
154 {
155 GitStatus: api.CodespaceGitStatus{
156 Ref: "trunk",
157 },
158 Repository: api.Repository{
159 FullName: "cli/cli",
160 },
161 DisplayName: "scuba steve",
162 },
163 },
164 },
165 wantCodespacesNames: []string{
166 "cli/cli [trunk]: scuba steve",
167 },
168 },
169 {
170 name: "Two codespaces on the same repo/branch: Adds the codespace's display name",
171 args: args{
172 codespaces: []*api.Codespace{
173 {
174 GitStatus: api.CodespaceGitStatus{
175 Ref: "trunk",
176 },
177 Repository: api.Repository{
178 FullName: "cli/cli",
179 },
180 DisplayName: "scuba steve",
181 },
182 {
183 GitStatus: api.CodespaceGitStatus{
184 Ref: "trunk",
185 },
186 Repository: api.Repository{
187 FullName: "cli/cli",
188 },
189 DisplayName: "flappy bird",
190 },
191 },
192 },
193 wantCodespacesNames: []string{
194 "cli/cli [trunk]: scuba steve",
195 "cli/cli [trunk]: flappy bird",
196 },
197 },
198 {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected