github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/command/common/command_list_v7_test.go (about)

     1  // +build V7
     2  
     3  package common_test
     4  
     5  import (
     6  	. "code.cloudfoundry.org/cli/command/common"
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  )
    10  
    11  var _ = Describe("commandList", func() {
    12  	Describe("HasCommand", func() {
    13  		When("the command name exists", func() {
    14  			It("returns true", func() {
    15  				Expect(Commands.HasCommand("version")).To(BeTrue())
    16  			})
    17  		})
    18  
    19  		When("the command name does not exist", func() {
    20  			It("returns false", func() {
    21  				Expect(Commands.HasCommand("does-not-exist")).To(BeFalse())
    22  			})
    23  		})
    24  
    25  		When("the command name is empty", func() {
    26  			It("returns false", func() {
    27  				Expect(Commands.HasCommand("")).To(BeFalse())
    28  			})
    29  		})
    30  	})
    31  
    32  	Describe("HasAlias", func() {
    33  		When("the command alias exists", func() {
    34  			It("returns true", func() {
    35  				Expect(Commands.HasAlias("cups")).To(BeTrue())
    36  			})
    37  		})
    38  
    39  		When("the command alias does not exist", func() {
    40  			It("returns false", func() {
    41  				Expect(Commands.HasAlias("does-not-exist")).To(BeFalse())
    42  			})
    43  		})
    44  
    45  		When("the command alias is empty", func() {
    46  			It("returns false", func() {
    47  				Expect(Commands.HasAlias("")).To(BeFalse())
    48  			})
    49  		})
    50  	})
    51  })