github.com/YousefHaggyHeroku/pack@v1.5.5/internal/commands/stack/suggest_test.go (about) 1 package stack 2 3 import ( 4 "bytes" 5 "testing" 6 7 "github.com/sclevine/spec" 8 "github.com/sclevine/spec/report" 9 "github.com/spf13/cobra" 10 11 "github.com/YousefHaggyHeroku/pack/internal/logging" 12 h "github.com/YousefHaggyHeroku/pack/testhelpers" 13 ) 14 15 func TestStacksSuggestCommand(t *testing.T) { 16 spec.Run(t, "StacksSuggestCommand", testStacksSuggestCommand, spec.Parallel(), spec.Report(report.Terminal{})) 17 } 18 19 func testStacksSuggestCommand(t *testing.T, when spec.G, it spec.S) { 20 var ( 21 command *cobra.Command 22 outBuf bytes.Buffer 23 ) 24 25 it.Before(func() { 26 command = suggest(logging.NewLogWithWriters(&outBuf, &outBuf)) 27 }) 28 29 when("#SuggestStacks", func() { 30 it("displays stack information", func() { 31 command.SetArgs([]string{}) 32 h.AssertNil(t, command.Execute()) 33 h.AssertEq(t, outBuf.String(), `Stacks maintained by the community: 34 35 Stack ID: heroku-18 36 Description: The official Heroku stack based on Ubuntu 18.04 37 Maintainer: Heroku 38 Build Image: heroku/pack:18-build 39 Run Image: heroku/pack:18 40 41 Stack ID: io.buildpacks.stacks.bionic 42 Description: A minimal Paketo stack based on Ubuntu 18.04 43 Maintainer: Paketo Project 44 Build Image: paketobuildpacks/build:base-cnb 45 Run Image: paketobuildpacks/run:base-cnb 46 47 Stack ID: io.buildpacks.stacks.bionic 48 Description: A large Paketo stack based on Ubuntu 18.04 49 Maintainer: Paketo Project 50 Build Image: paketobuildpacks/build:full-cnb 51 Run Image: paketobuildpacks/run:full-cnb 52 53 Stack ID: io.paketo.stacks.tiny 54 Description: A tiny Paketo stack based on Ubuntu 18.04, similar to distroless 55 Maintainer: Paketo Project 56 Build Image: paketobuildpacks/build:tiny-cnb 57 Run Image: paketobuildpacks/run:tiny-cnb 58 `) 59 }) 60 }) 61 }