(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestStackPsErrors(t *testing.T) { |
| 20 | testCases := []struct { |
| 21 | args []string |
| 22 | taskListFunc func(options client.TaskListOptions) (client.TaskListResult, error) |
| 23 | expectedError string |
| 24 | }{ |
| 25 | { |
| 26 | args: []string{}, |
| 27 | expectedError: "requires 1 argument", |
| 28 | }, |
| 29 | { |
| 30 | args: []string{"foo", "bar"}, |
| 31 | expectedError: "requires 1 argument", |
| 32 | }, |
| 33 | { |
| 34 | args: []string{"foo"}, |
| 35 | taskListFunc: func(options client.TaskListOptions) (client.TaskListResult, error) { |
| 36 | return client.TaskListResult{}, errors.New("error getting tasks") |
| 37 | }, |
| 38 | expectedError: "error getting tasks", |
| 39 | }, |
| 40 | } |
| 41 | |
| 42 | for _, tc := range testCases { |
| 43 | t.Run(tc.expectedError, func(t *testing.T) { |
| 44 | cmd := newPsCommand(test.NewFakeCli(&fakeClient{ |
| 45 | taskListFunc: tc.taskListFunc, |
| 46 | })) |
| 47 | cmd.SetArgs(tc.args) |
| 48 | cmd.SetOut(io.Discard) |
| 49 | cmd.SetErr(io.Discard) |
| 50 | assert.ErrorContains(t, cmd.Execute(), tc.expectedError) |
| 51 | }) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | func TestStackPs(t *testing.T) { |
| 56 | testCases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…