github.com/Liam-Williams/i18n4go@v0.2.7-0.20201028180611-670cbaceaa6b/integration/verify_strings/duplicate_keys_test.go (about) 1 package verify_strings_test 2 3 import ( 4 "os" 5 "path/filepath" 6 7 . "github.com/Liam-Williams/i18n4go/integration/test_helpers" 8 . "github.com/onsi/ginkgo" 9 . "github.com/onsi/gomega" 10 "github.com/onsi/gomega/gbytes" 11 ) 12 13 var _ = Describe("verify-strings -f fileName", func() { 14 var ( 15 fixturesPath string 16 inputFilesPath string 17 expectedFilesPath string 18 ) 19 20 BeforeEach(func() { 21 _, err := os.Getwd() 22 Ω(err).ShouldNot(HaveOccurred()) 23 24 Ω(err).ToNot(HaveOccurred()) 25 26 fixturesPath = filepath.Join("..", "..", "test_fixtures", "verify_strings") 27 inputFilesPath = filepath.Join(fixturesPath, "duplicate_keys", "input_files") 28 expectedFilesPath = filepath.Join(fixturesPath, "duplicate_keys", "expected_output") 29 }) 30 31 Context("checks for duplicate keys", func() { 32 It("should error", func() { 33 session := Runi18n("-c", "verify-strings", "-v", "-f", filepath.Join(inputFilesPath, "quota.go.en.json"), "--languages", "\"fr\"", "-o", expectedFilesPath, "--source-language", "en") 34 Ω(session.ExitCode()).Should(Equal(1)) 35 Ω(session).Should(gbytes.Say("Duplicated key found: Show quota info")) 36 }) 37 }) 38 })