| 9 | ) |
| 10 | |
| 11 | func TestSelectWithCodespaceName(t *testing.T) { |
| 12 | wantName := "mock-codespace" |
| 13 | |
| 14 | api := &apiClientMock{ |
| 15 | GetCodespaceFunc: func(ctx context.Context, name string, includeConnection bool) (*api.Codespace, error) { |
| 16 | if name != wantName { |
| 17 | t.Errorf("incorrect name: want %s, got %s", wantName, name) |
| 18 | } |
| 19 | |
| 20 | return &api.Codespace{}, nil |
| 21 | }, |
| 22 | } |
| 23 | |
| 24 | cs := &CodespaceSelector{api: api, codespaceName: wantName} |
| 25 | |
| 26 | _, err := cs.Select(context.Background()) |
| 27 | |
| 28 | if err != nil { |
| 29 | t.Errorf("unexpected error: %v", err) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | func TestSelectNameWithCodespaceName(t *testing.T) { |
| 34 | wantName := "mock-codespace" |