(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestNewCmdChecks(t *testing.T) { |
| 25 | tests := []struct { |
| 26 | name string |
| 27 | cli string |
| 28 | wants ChecksOptions |
| 29 | wantsError string |
| 30 | }{ |
| 31 | { |
| 32 | name: "no arguments", |
| 33 | cli: "", |
| 34 | wants: ChecksOptions{ |
| 35 | Interval: time.Duration(10000000000), |
| 36 | }, |
| 37 | }, |
| 38 | { |
| 39 | name: "pr argument", |
| 40 | cli: "1234", |
| 41 | wants: ChecksOptions{ |
| 42 | SelectorArg: "1234", |
| 43 | Interval: time.Duration(10000000000), |
| 44 | }, |
| 45 | }, |
| 46 | { |
| 47 | name: "watch flag", |
| 48 | cli: "--watch", |
| 49 | wants: ChecksOptions{ |
| 50 | Watch: true, |
| 51 | Interval: time.Duration(10000000000), |
| 52 | }, |
| 53 | }, |
| 54 | { |
| 55 | name: "watch flag and interval flag", |
| 56 | cli: "--watch --interval 5", |
| 57 | wants: ChecksOptions{ |
| 58 | Watch: true, |
| 59 | Interval: time.Duration(5000000000), |
| 60 | }, |
| 61 | }, |
| 62 | { |
| 63 | name: "interval flag without watch flag", |
| 64 | cli: "--interval 5", |
| 65 | wantsError: "cannot use `--interval` flag without `--watch` flag", |
| 66 | }, |
| 67 | { |
| 68 | name: "watch with fail-fast flag", |
| 69 | cli: "--watch --fail-fast", |
| 70 | wants: ChecksOptions{ |
| 71 | Watch: true, |
| 72 | FailFast: true, |
| 73 | Interval: time.Duration(10000000000), |
| 74 | }, |
| 75 | }, |
| 76 | { |
| 77 | name: "fail-fast flag without watch flag", |
| 78 | cli: "--fail-fast", |
| 79 | wantsError: "cannot use `--fail-fast` flag without `--watch` flag", |
| 80 | }, |
| 81 | { |
nothing calls this directly
no test coverage detected