github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/util/spellcheck/spellcheck_test.go (about) 1 package spellcheck_test 2 3 import ( 4 . "code.cloudfoundry.org/cli/cf/util/spellcheck" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 ) 9 10 var _ = Describe("Spellcheck", func() { 11 var commandSuggester CommandSuggester 12 BeforeEach(func() { 13 existingCmds := []string{"fake-command", "fake-command2", "help"} 14 commandSuggester = NewCommandSuggester(existingCmds) 15 }) 16 17 Context("when there is no input", func() { 18 It("returns empty slice", func() { 19 Expect(commandSuggester.Recommend("")).To(Equal([]string{})) 20 }) 21 }) 22 23 Context("when there is an input", func() { 24 It("returns recommendations", func() { 25 Expect(commandSuggester.Recommend("hlp")).To(Equal([]string{"help"})) 26 }) 27 }) 28 })