From 38cd52ffd6f693b703e64fa771bb058ab353aba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20P=C4=99czkowski?= Date: Sun, 7 Nov 2021 00:43:40 +0100 Subject: [PATCH] Simplify function and structure names for tests --- commands/common_utils_test.go | 10 +++++----- commands/status_cmd_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) 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)