MCPcopy Create free account
hub / github.com/cli/cli / TestBuildDisplayName

Function TestBuildDisplayName

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

buildDisplayNameFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected