github.com/everlongproject/i18n4go@v0.2.7-0.20201028180611-670cbaceaa6b/integration/merge_strings/r_option_test.go (about) 1 package merge_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 ) 11 12 var _ = Describe("merge-strings -d dirName -r", func() { 13 var ( 14 fixturesPath string 15 inputFilesPath string 16 expectedFilesPath string 17 ) 18 19 BeforeEach(func() { 20 _, err := os.Getwd() 21 Ω(err).ShouldNot(HaveOccurred()) 22 23 fixturesPath = filepath.Join("..", "..", "test_fixtures", "merge_strings") 24 inputFilesPath = filepath.Join(fixturesPath, "r_option", "input_files") 25 expectedFilesPath = filepath.Join(fixturesPath, "r_option", "expected_output") 26 }) 27 28 Context("can combine multiple language files per directory", func() { 29 BeforeEach(func() { 30 session := Runi18n("-c", "merge-strings", "-v", "-r", "-d", filepath.Join(inputFilesPath), "--source-language", "en") 31 Ω(session.ExitCode()).Should(Equal(0)) 32 }) 33 34 AfterEach(func() { 35 RemoveAllFiles( 36 GetFilePath(inputFilesPath, "en.all.json"), 37 GetFilePath(inputFilesPath+"/sub", "en.all.json"), 38 ) 39 }) 40 41 It("en.all.json contains translations from both files", func() { 42 CompareExpectedToGeneratedTraslationJson( 43 GetFilePath(expectedFilesPath, "en.all.json"), 44 GetFilePath(inputFilesPath, "en.all.json"), 45 ) 46 CompareExpectedToGeneratedTraslationJson( 47 GetFilePath(expectedFilesPath+"/sub", "en.all.json"), 48 GetFilePath(inputFilesPath+"/sub", "en.all.json"), 49 ) 50 }) 51 }) 52 53 })