Skip to content
This repository has been archived by the owner on Dec 29, 2024. It is now read-only.

Commit

Permalink
fix(config): fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
Wittano committed Nov 28, 2023
1 parent af95534 commit feafb0d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions setting/config_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/wittano/filebot/internal/test"
"os"
"strings"
"testing"
)

Expand Down Expand Up @@ -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,
}
Expand All @@ -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)
}
Expand Down

0 comments on commit feafb0d

Please sign in to comment.