github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/offering/offering_test.go (about) 1 /* 2 * Copyright contributors to the Hyperledger Fabric Operator project 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at: 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package offering_test 20 21 import ( 22 "github.com/IBM-Blockchain/fabric-operator/pkg/offering" 23 . "github.com/onsi/ginkgo/v2" 24 . "github.com/onsi/gomega" 25 ) 26 27 var _ = Describe("Peer configuration", func() { 28 Context("get type", func() { 29 30 It("returns type OPENSHIFT", func() { 31 t, err := offering.GetType("OPENSHIFT") 32 Expect(err).To(BeNil()) 33 Expect(t).To(Equal(offering.OPENSHIFT)) 34 35 t, err = offering.GetType("openshift") 36 Expect(err).To(BeNil()) 37 Expect(t).To(Equal(offering.OPENSHIFT)) 38 }) 39 40 It("returns an error for unrecongized input", func() { 41 _, err := offering.GetType("foo") 42 Expect(err).NotTo(BeNil()) 43 }) 44 45 It("returns type K8S for input of k8s", func() { 46 t, err := offering.GetType("K8S") 47 Expect(err).To(BeNil()) 48 Expect(t).To(Equal(offering.K8S)) 49 50 t, err = offering.GetType("k8s") 51 Expect(err).To(BeNil()) 52 Expect(t).To(Equal(offering.K8S)) 53 }) 54 }) 55 })