diff --git a/commands/common_utils_test.go b/commands/common_utils_test.go index 706c5c5..07dfc8b 100644 --- a/commands/common_utils_test.go +++ b/commands/common_utils_test.go @@ -13,7 +13,7 @@ import ( "gitlab.com/revalus/grm/config" ) -type TestDir struct { +type TestSetup struct { rootFS billy.Filesystem baseRepository struct { fileSystem billy.Filesystem @@ -42,7 +42,7 @@ func createTmpDir() string { return tempDir } -func getTestDirForTests() TestDir { +func getTestSetup() TestSetup { tmpDir := createTmpDir() @@ -71,7 +71,7 @@ func getTestDirForTests() TestDir { checkErrorDuringPreparation(err) - return TestDir{ + return TestSetup{ baseRepository: struct { fileSystem billy.Filesystem repo *git.Repository @@ -100,8 +100,8 @@ func getFSForLocalRepo(dirName string, baseFileSystem billy.Filesystem) (billy.F return fsForLocalRepo, storageForTestRepo } -func getBaseForTestingSyncCommand() (StatusChecker, *git.Repository, config.RepositoryConfig, TestDir) { - tmpDirWithInitialRepository := getTestDirForTests() +func getBaseForTestingSyncCommand() (StatusChecker, *git.Repository, config.RepositoryConfig, TestSetup) { + tmpDirWithInitialRepository := getTestSetup() dirNameForLocalRepository := "testRepo" fsForLocalRepo, storageForTestRepo := getFSForLocalRepo(dirNameForLocalRepository, tmpDirWithInitialRepository.rootFS) diff --git a/commands/status_cmd_test.go b/commands/status_cmd_test.go index 746f5bf..07f61fb 100644 --- a/commands/status_cmd_test.go +++ b/commands/status_cmd_test.go @@ -12,7 +12,7 @@ import ( ) func TestIfBranchesAreEqual(t *testing.T) { - tmpDirWithInitialRepository := getTestDirForTests() + tmpDirWithInitialRepository := getTestSetup() fakeLocalRepo, err := git.Clone(memory.NewStorage(), memfs.New(), &git.CloneOptions{ URL: tmpDirWithInitialRepository.baseRepository.fileSystem.Root(), @@ -42,7 +42,7 @@ func TestIfBranchesAreEqual(t *testing.T) { func TestIfCurrentBranchIsDifferent(t *testing.T) { - tmpDirWithInitialRepository := getTestDirForTests() + tmpDirWithInitialRepository := getTestSetup() fakeLocalRepo, err := git.Clone(memory.NewStorage(), memfs.New(), &git.CloneOptions{ URL: tmpDirWithInitialRepository.baseRepository.fileSystem.Root(), }) @@ -91,7 +91,7 @@ func TestIfCurrentBranchIsDifferent(t *testing.T) { func TestCommandRepositoryDoesNotExists(t *testing.T) { - tmpDirWithInitialRepository := getTestDirForTests() + tmpDirWithInitialRepository := getTestSetup() fsForLocalRepo, storageForTestRepo := getFSForLocalRepo("noMatterValue", tmpDirWithInitialRepository.rootFS) _, err := git.Clone(storageForTestRepo, fsForLocalRepo, &git.CloneOptions{ @@ -127,7 +127,7 @@ func TestCommandRepositoryDoesNotExists(t *testing.T) { func TestCommandRepositoryNoRemoteBranch(t *testing.T) { - tmpDirWithInitialRepository := getTestDirForTests() + tmpDirWithInitialRepository := getTestSetup() dirNameForLocalRepository := "testRepo" fsForLocalRepo, storageForTestRepo := getFSForLocalRepo(dirNameForLocalRepository, tmpDirWithInitialRepository.rootFS)