github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/command/flag/app_type_test.go (about)

     1  package flag_test
     2  
     3  import (
     4  	. "code.cloudfoundry.org/cli/command/flag"
     5  	flags "github.com/jessevdk/go-flags"
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/ginkgo/extensions/table"
     8  	. "github.com/onsi/gomega"
     9  )
    10  
    11  var _ = Describe("AppType", func() {
    12  	var appType AppType
    13  
    14  	Describe("Complete", func() {
    15  		DescribeTable("returns list of completions",
    16  			func(prefix string, matches []flags.Completion) {
    17  				completions := appType.Complete(prefix)
    18  				Expect(completions).To(Equal(matches))
    19  			},
    20  
    21  			Entry("completes to 'buildpack' when passed 'b'", "b",
    22  				[]flags.Completion{{Item: "buildpack"}}),
    23  			Entry("completes to 'docker' when passed 'd'", "d",
    24  				[]flags.Completion{{Item: "docker"}}),
    25  			Entry("completes to 'buildpack' when passed 'bU'", "bU",
    26  				[]flags.Completion{{Item: "buildpack"}}),
    27  			Entry("completes to 'docker' when passed 'Do'", "Do",
    28  				[]flags.Completion{{Item: "docker"}}),
    29  			Entry("returns 'buildpack' and 'docker' when passed nothing", "",
    30  				[]flags.Completion{{Item: "buildpack"}, {Item: "docker"}}),
    31  			Entry("completes to nothing when passed 'wut'", "wut",
    32  				[]flags.Completion{}),
    33  		)
    34  	})
    35  })