MCPcopy Index your code
hub / github.com/cli/cli / Test_WithPrAndIssueQueryParams

Function Test_WithPrAndIssueQueryParams

pkg/cmd/pr/shared/params_test.go:434–485  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

432}
433
434func Test_WithPrAndIssueQueryParams(t *testing.T) {
435 type args struct {
436 baseURL string
437 state IssueMetadataState
438 }
439 tests := []struct {
440 name string
441 args args
442 want string
443 wantErr bool
444 }{
445 {
446 name: "blank",
447 args: args{
448 baseURL: "",
449 state: IssueMetadataState{},
450 },
451 want: "?body=",
452 },
453 {
454 name: "no values",
455 args: args{
456 baseURL: "http://example.com/hey",
457 state: IssueMetadataState{},
458 },
459 want: "http://example.com/hey?body=",
460 },
461 {
462 name: "title and body",
463 args: args{
464 baseURL: "http://example.com/hey",
465 state: IssueMetadataState{
466 Title: "my title",
467 Body: "my bodeh",
468 },
469 },
470 want: "http://example.com/hey?body=my+bodeh&title=my+title",
471 },
472 }
473 for _, tt := range tests {
474 t.Run(tt.name, func(t *testing.T) {
475 got, err := WithPrAndIssueQueryParams(nil, nil, tt.args.baseURL, tt.args.state, gh.ProjectsV1Supported)
476 if (err != nil) != tt.wantErr {
477 t.Errorf("WithPrAndIssueQueryParams() error = %v, wantErr %v", err, tt.wantErr)
478 return
479 }
480 if got != tt.want {
481 t.Errorf("WithPrAndIssueQueryParams() = %v, want %v", got, tt.want)
482 }
483 })
484 }
485}
486
487// TODO projectsV1Deprecation
488// Remove this test.

Callers

nothing calls this directly

Calls 3

RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected