github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/i18n/locale_test.go (about)

     1  package i18n_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/cf/i18n"
     5  
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("I18n", func() {
    11  	Describe("SupportedLocales", func() {
    12  		It("returns the list of locales in resources", func() {
    13  			supportedLocales := i18n.SupportedLocales()
    14  			Expect(supportedLocales).To(ContainElement("fr-FR"))
    15  			Expect(supportedLocales).To(ContainElement("it-IT"))
    16  			Expect(supportedLocales).To(ContainElement("ja-JP"))
    17  			Expect(supportedLocales).To(ContainElement("zh-Hans"))
    18  			Expect(supportedLocales).To(ContainElement("zh-Hant"))
    19  			Expect(supportedLocales).To(ContainElement("en-US"))
    20  			Expect(supportedLocales).To(ContainElement("es-ES"))
    21  			Expect(supportedLocales).To(ContainElement("pt-BR"))
    22  			Expect(supportedLocales).To(ContainElement("de-DE"))
    23  			Expect(supportedLocales).To(ContainElement("ko-KR"))
    24  		})
    25  	})
    26  
    27  	Describe("IsSupportedLocale", func() {
    28  		It("returns true for supported locales", func() {
    29  			Expect(i18n.IsSupportedLocale("fr-FR")).To(BeTrue())
    30  			Expect(i18n.IsSupportedLocale("Fr_Fr")).To(BeTrue())
    31  
    32  			Expect(i18n.IsSupportedLocale("it-IT")).To(BeTrue())
    33  			Expect(i18n.IsSupportedLocale("ja-JP")).To(BeTrue())
    34  			Expect(i18n.IsSupportedLocale("zh-Hans")).To(BeTrue())
    35  			Expect(i18n.IsSupportedLocale("zh-Hant")).To(BeTrue())
    36  			Expect(i18n.IsSupportedLocale("en-US")).To(BeTrue())
    37  			Expect(i18n.IsSupportedLocale("es-ES")).To(BeTrue())
    38  			Expect(i18n.IsSupportedLocale("pt-BR")).To(BeTrue())
    39  			Expect(i18n.IsSupportedLocale("de-DE")).To(BeTrue())
    40  			Expect(i18n.IsSupportedLocale("ko-KR")).To(BeTrue())
    41  		})
    42  
    43  		It("returns false for unsupported locales", func() {
    44  			Expect(i18n.IsSupportedLocale("potato-Tomato")).To(BeFalse())
    45  		})
    46  	})
    47  })