github.com/LukasHeimann/cloudfoundrycli/v8@v8.4.4/command/common/command_list_v7_test.go (about)

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