MCPcopy
hub / github.com/cli/cli / Test_checkRun

Function Test_checkRun

pkg/cmd/ruleset/check/check_test.go:117–233  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func Test_checkRun(t *testing.T) {
118 tests := []struct {
119 name string
120 isTTY bool
121 opts CheckOptions
122 wantErr string
123 wantStdout string
124 wantStderr string
125 wantBrowse string
126 }{
127 {
128 name: "view rules for branch",
129 isTTY: true,
130 opts: CheckOptions{
131 Branch: "my-branch",
132 },
133 wantStdout: heredoc.Doc(`
134 6 rules apply to branch my-branch in repo my-org/repo-name
135
136 - commit_author_email_pattern: [name: ] [negate: false] [operator: ends_with] [pattern: @example.com]
137 (configured in ruleset 1234 from organization my-org)
138
139 - commit_author_email_pattern: [name: ] [negate: false] [operator: ends_with] [pattern: @example.com]
140 (configured in ruleset 5678 from repository my-org/repo-name)
141
142 - commit_message_pattern: [name: ] [negate: false] [operator: starts_with] [pattern: fff]
143 (configured in ruleset 1234 from organization my-org)
144
145 - commit_message_pattern: [name: ] [negate: false] [operator: contains] [pattern: asdf]
146 (configured in ruleset 5678 from repository my-org/repo-name)
147
148 - creation
149 (configured in ruleset 5678 from repository my-org/repo-name)
150
151 - required_signatures
152 (configured in ruleset 1234 from organization my-org)
153
154 `),
155 wantStderr: "",
156 wantBrowse: "",
157 },
158 {
159 name: "web mode, TTY",
160 isTTY: true,
161 opts: CheckOptions{
162 Branch: "my-branch",
163 WebMode: true,
164 },
165 wantStdout: "Opening https://github.com/my-org/repo-name/rules in your browser.\n",
166 wantStderr: "",
167 wantBrowse: "https://github.com/my-org/repo-name/rules?ref=refs%2Fheads%2Fmy-branch",
168 },
169 {
170 name: "web mode, TTY, special character in branch name",
171 isTTY: true,
172 opts: CheckOptions{
173 Branch: "my-feature/my-branch",
174 WebMode: true,

Callers

nothing calls this directly

Calls 13

RegisterMethod · 0.95
VerifyMethod · 0.95
TestFunction · 0.92
RESTFunction · 0.92
FileResponseFunction · 0.92
FromFullNameFunction · 0.92
checkRunFunction · 0.85
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected