github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/actor/actionerror/route_not_found_error_test.go (about)

     1  package actionerror_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/actor/actionerror"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("RouteNotFoundError", func() {
    10  	It("returns an error message referencing domain, host and path", func() {
    11  		err := actionerror.RouteNotFoundError{
    12  			DomainName: "some-domain.com",
    13  			Path:       "mypath",
    14  			Host:       "hostname",
    15  		}
    16  		Expect(err).To(MatchError("Route with host 'hostname', domain 'some-domain.com', and path 'mypath' not found."))
    17  	})
    18  
    19  	When("the hostname and path are empty", func() {
    20  		It("return an error with empty hostname and path", func() {
    21  			err := actionerror.RouteNotFoundError{DomainName: "some-domain.com"}
    22  			Expect(err).To(MatchError("Route with host '', domain 'some-domain.com', and path '/' not found."))
    23  		})
    24  	})
    25  
    26  	When("the port is specified", func() {
    27  		It("returns an error message referencing domain and port", func() {
    28  			err := actionerror.RouteNotFoundError{
    29  				DomainName: "some-domain.com",
    30  				Port:       1052,
    31  			}
    32  			Expect(err).To(MatchError("Route with domain 'some-domain.com' and port 1052 not found."))
    33  		})
    34  	})
    35  })