github.com/LukasHeimann/cloudfoundrycli/v8@v8.4.4/command/translatableerror/service_plan_not_found_error_test.go (about)

     1  package translatableerror_test
     2  
     3  import (
     4  	"github.com/LukasHeimann/cloudfoundrycli/v8/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 offering '{{.OfferingName}}'."))
    18  	})
    19  
    20  	It("returns a message with the service offering name and broker name", func() {
    21  		offeringName := "some-service-offering"
    22  		planName := "some-plan"
    23  		brokerName := "broker-name"
    24  		err := translatableerror.ServicePlanNotFoundError{
    25  			OfferingName:      offeringName,
    26  			PlanName:          planName,
    27  			ServiceBrokerName: brokerName,
    28  		}
    29  		Expect(err.Error()).To(Equal("The plan '{{.PlanName}}' could not be found for service offering '{{.OfferingName}}' and broker '{{.ServiceBrokerName}}'."))
    30  	})
    31  
    32  	When("there is no service offering name", func() {
    33  		It("returns a generic message", func() {
    34  			err := translatableerror.ServicePlanNotFoundError{
    35  				PlanName: "some-plan",
    36  			}
    37  			Expect(err.Error()).To(Equal("Service plan '{{.PlanName}}' not found."))
    38  		})
    39  	})
    40  })