MCPcopy
hub / github.com/cli/cli / TestBuildDisplayName

Function TestBuildDisplayName

pkg/cmd/codespace/create_test.go:669–705  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

667}
668
669func TestBuildDisplayName(t *testing.T) {
670 tests := []struct {
671 name string
672 prebuildAvailability string
673 expectedDisplayName string
674 }{
675 {
676 name: "prebuild availability is none",
677 prebuildAvailability: "none",
678 expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage",
679 },
680 {
681 name: "prebuild availability is empty",
682 prebuildAvailability: "",
683 expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage",
684 },
685 {
686 name: "prebuild availability is ready",
687 prebuildAvailability: "ready",
688 expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage (Prebuild ready)",
689 },
690 {
691 name: "prebuild availability is in_progress",
692 prebuildAvailability: "in_progress",
693 expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage (Prebuild in progress)",
694 },
695 }
696 for _, tt := range tests {
697 t.Run(tt.name, func(t *testing.T) {
698 displayName := buildDisplayName("4 cores, 8 GB RAM, 32 GB storage", tt.prebuildAvailability)
699
700 if displayName != tt.expectedDisplayName {
701 t.Errorf("displayName = %q, expectedDisplayName %q", displayName, tt.expectedDisplayName)
702 }
703 })
704 }
705}
706
707type MockSurveyPrompter struct {
708 AskFunc func(qs []*survey.Question, response interface{}) error

Callers

nothing calls this directly

Calls 3

buildDisplayNameFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected