github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/actor/v7pushaction/handle_flag_overrides_test.go (about) 1 package v7pushaction_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/actor/v7pushaction" 5 "code.cloudfoundry.org/cli/util/manifestparser" 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("HandleFlagOverrides", func() { 11 var ( 12 pushActor *Actor 13 baseManifest manifestparser.Manifest 14 flagOverrides FlagOverrides 15 transformedManifest manifestparser.Manifest 16 executeErr error 17 18 testFuncCallCount int 19 ) 20 21 testTransformManifestFunc := func(manifest manifestparser.Manifest, overrides FlagOverrides) (manifestparser.Manifest, error) { 22 testFuncCallCount += 1 23 return manifest, nil 24 } 25 26 BeforeEach(func() { 27 baseManifest = manifestparser.Manifest{} 28 flagOverrides = FlagOverrides{} 29 testFuncCallCount = 0 30 31 pushActor, _, _ = getTestPushActor() 32 pushActor.TransformManifestSequence = []HandleFlagOverrideFunc{ 33 testTransformManifestFunc, 34 } 35 }) 36 37 JustBeforeEach(func() { 38 transformedManifest, executeErr = pushActor.HandleFlagOverrides(baseManifest, flagOverrides) 39 }) 40 41 It("calls each transform-manifest function", func() { 42 Expect(testFuncCallCount).To(Equal(1)) 43 Expect(executeErr).NotTo(HaveOccurred()) 44 Expect(transformedManifest).To(Equal(baseManifest)) 45 }) 46 })