MCPcopy
hub / github.com/cli/cli / TestDelete

Function TestDelete

pkg/cmd/codespace/delete_test.go:18–337  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestDelete(t *testing.T) {
19 now, _ := time.Parse(time.RFC3339, "2021-09-22T00:00:00Z")
20 daysAgo := func(n int) string {
21 return now.Add(time.Hour * -time.Duration(24*n)).Format(time.RFC3339)
22 }
23
24 tests := []struct {
25 name string
26 opts deleteOptions
27 codespaces []*api.Codespace
28 confirms map[string]bool
29 deleteErr error
30 wantErr string
31 wantDeleted []string
32 wantStdout string
33 wantStderr string
34 }{
35 {
36 name: "by name",
37 opts: deleteOptions{
38 codespaceName: "hubot-robawt-abc",
39 },
40 codespaces: []*api.Codespace{
41 {
42 Name: "hubot-robawt-abc",
43 },
44 },
45 wantDeleted: []string{"hubot-robawt-abc"},
46 wantStderr: "1 codespace(s) deleted successfully\n",
47 },
48 {
49 name: "by repo",
50 opts: deleteOptions{
51 repoFilter: "monalisa/spoon-knife",
52 },
53 codespaces: []*api.Codespace{
54 {
55 Name: "monalisa-spoonknife-123",
56 Repository: api.Repository{
57 FullName: "monalisa/Spoon-Knife",
58 },
59 },
60 {
61 Name: "hubot-robawt-abc",
62 Repository: api.Repository{
63 FullName: "hubot/ROBAWT",
64 },
65 },
66 {
67 Name: "monalisa-spoonknife-c4f3",
68 Repository: api.Repository{
69 FullName: "monalisa/Spoon-Knife",
70 },
71 },
72 },
73 wantDeleted: []string{"monalisa-spoonknife-123", "monalisa-spoonknife-c4f3"},
74 wantStderr: "2 codespace(s) deleted successfully\n",
75 },

Callers

nothing calls this directly

Calls 15

DeleteMethod · 0.95
ListCodespacesCallsMethod · 0.95
DeleteCodespaceCallsMethod · 0.95
TestFunction · 0.92
NewAppFunction · 0.85
sortLinesFunction · 0.85
DurationMethod · 0.80
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
AddMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected