MCPcopy
hub / github.com/cli/cli / Test_transformSquashMergeOpts

Function Test_transformSquashMergeOpts

pkg/cmd/repo/edit/edit_test.go:935–978  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

933}
934
935func Test_transformSquashMergeOpts(t *testing.T) {
936 tests := []struct {
937 name string
938 input string
939 wantTitle string
940 wantMessage string
941 }{
942 {
943 name: "default",
944 input: "default",
945 wantTitle: "COMMIT_OR_PR_TITLE",
946 wantMessage: "COMMIT_MESSAGES",
947 },
948 {
949 name: "pr-title",
950 input: "pr-title",
951 wantTitle: "PR_TITLE",
952 wantMessage: "BLANK",
953 },
954 {
955 name: "pr-title-commits",
956 input: "pr-title-commits",
957 wantTitle: "PR_TITLE",
958 wantMessage: "COMMIT_MESSAGES",
959 },
960 {
961 name: "pr-title-description",
962 input: "pr-title-description",
963 wantTitle: "PR_TITLE",
964 wantMessage: "PR_BODY",
965 },
966 }
967
968 for _, tt := range tests {
969 t.Run(tt.name, func(t *testing.T) {
970 edits := &EditRepositoryInput{
971 squashMergeCommitMsg: sp(tt.input),
972 }
973 transformSquashMergeOpts(edits)
974 assert.Equal(t, tt.wantTitle, *edits.SquashMergeCommitTitle)
975 assert.Equal(t, tt.wantMessage, *edits.SquashMergeCommitMessage)
976 })
977 }
978}
979
980func Test_transformSquashMergeOpts_unknownInput(t *testing.T) {
981 edits := &EditRepositoryInput{

Callers

nothing calls this directly

Calls 4

spFunction · 0.85
transformSquashMergeOptsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected