From feafb0ddec1f3a52fc51256665347724b0cbd7fc Mon Sep 17 00:00:00 2001 From: Wittano Date: Tue, 28 Nov 2023 16:44:33 +0100 Subject: [PATCH] fix(config): fixed test --- setting/config_file_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setting/config_file_test.go b/setting/config_file_test.go index 0b750a4..26336dc 100644 --- a/setting/config_file_test.go +++ b/setting/config_file_test.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/wittano/filebot/internal/test" "os" + "strings" "testing" ) @@ -35,9 +36,10 @@ func TestFailedLoadingConfig(t *testing.T) { func TestGetTrashDir(t *testing.T) { destDir := t.TempDir() + tempFile := test.CreateTempFile(t) d := Directory{ - Src: []string{test.CreateTempFile(t)}, + Src: []string{tempFile}, Dest: destDir, MoveToTrash: true, } @@ -51,7 +53,13 @@ func TestGetTrashDir(t *testing.T) { t.Fatal("MoveToTrash field is false") } - exp := fmt.Sprintf("/tmp/.Trash-%d/files", os.Getuid()) + var exp string + if strings.Contains(destDir, "/tmp") { + exp = fmt.Sprintf("/tmp/.Trash-%d/files", os.Getuid()) + } else { + exp = fmt.Sprintf("%s/.local/share/.Trash-%d/files", os.Getenv("HOME"), os.Getuid()) + } + if exp != res { t.Fatalf("Trash dir is diffrent. Expected: %s, Actually: %s", exp, res) }