(t *testing.T)
| 20 | ) |
| 21 | |
| 22 | func TestNewCmdDelete(t *testing.T) { |
| 23 | tests := []struct { |
| 24 | name string |
| 25 | args string |
| 26 | stdinTTY bool |
| 27 | stdoutTTY bool |
| 28 | ghRepo string |
| 29 | wantOpts DeleteOptions |
| 30 | wantRepo string |
| 31 | wantErr string |
| 32 | wantFlagErr bool |
| 33 | }{ |
| 34 | { |
| 35 | name: "an issue number and an artifact number", |
| 36 | args: "142 2", |
| 37 | stdinTTY: true, |
| 38 | stdoutTTY: true, |
| 39 | wantOpts: DeleteOptions{IssueNumber: 142, ArtifactNumbers: []int{2}}, |
| 40 | wantRepo: "OWNER/REPO", |
| 41 | }, |
| 42 | { |
| 43 | name: "several artifact numbers keep their order", |
| 44 | args: "142 5 2", |
| 45 | stdinTTY: true, |
| 46 | stdoutTTY: true, |
| 47 | wantOpts: DeleteOptions{IssueNumber: 142, ArtifactNumbers: []int{5, 2}}, |
| 48 | wantRepo: "OWNER/REPO", |
| 49 | }, |
| 50 | { |
| 51 | name: "a repeated artifact number is refused", |
| 52 | args: "142 2 5 2", |
| 53 | stdinTTY: true, |
| 54 | stdoutTTY: true, |
| 55 | wantErr: "duplicate artifact number: 2", |
| 56 | wantFlagErr: true, |
| 57 | }, |
| 58 | { |
| 59 | name: "a number written two ways is refused", |
| 60 | args: "142 2 02", |
| 61 | stdinTTY: true, |
| 62 | stdoutTTY: true, |
| 63 | wantErr: "duplicate artifact number: 2", |
| 64 | wantFlagErr: true, |
| 65 | }, |
| 66 | { |
| 67 | name: "a repeated artifact number fails before --yes is required", |
| 68 | args: "142 2 2", |
| 69 | wantErr: "duplicate artifact number: 2", |
| 70 | wantFlagErr: true, |
| 71 | }, |
| 72 | { |
| 73 | name: "an issue URL names the repository", |
| 74 | args: "https://github.com/monalisa/monas-cafe/issues/142 2", |
| 75 | stdinTTY: true, |
| 76 | stdoutTTY: true, |
| 77 | wantOpts: DeleteOptions{IssueNumber: 142, ArtifactNumbers: []int{2}}, |
| 78 | wantRepo: "monalisa/monas-cafe", |
| 79 | }, |
nothing calls this directly
no test coverage detected