github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/utils/spellcheck/spellcheck_test.go (about) 1 package spellcheck_test 2 3 import ( 4 . "github.com/cloudfoundry/cli/utils/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 })