github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/command/translatableerror/service_plan_not_found_error_test.go (about)

     1  package translatableerror_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command/translatableerror"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("ServicePlanNotFoundError", func() {
    10  	It("returns a message with the service offering name", func() {
    11  		offeringName := "some-service-offering"
    12  		planName := "some-plan"
    13  		err := translatableerror.ServicePlanNotFoundError{
    14  			OfferingName: offeringName,
    15  			PlanName:     planName,
    16  		}
    17  		Expect(err.Error()).To(Equal("The plan {{.PlanName}} could not be found for service {{.OfferingName}}."))
    18  	})
    19  
    20  	When("there is no service offering name", func() {
    21  		It("returns a generic message", func() {
    22  			err := translatableerror.ServicePlanNotFoundError{
    23  				PlanName: "some-plan",
    24  			}
    25  			Expect(err.Error()).To(Equal("Service plan '{{.PlanName}}' not found."))
    26  		})
    27  	})
    28  })