Pkg: Use ProjectRoot variable in path_test.go

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-11-02 11:56:43 +01:00
parent 3874bc5422
commit bbee0993e0
2 changed files with 9 additions and 1 deletions

8
pkg/clean/clean_test.go Normal file
View File

@@ -0,0 +1,8 @@
package clean
import (
"path/filepath"
)
// ProjectRoot references the project root directory for use in tests.
var ProjectRoot = func() string { dir, _ := filepath.Abs("../../"); return dir }()

View File

@@ -8,7 +8,7 @@ import (
func TestPath(t *testing.T) { func TestPath(t *testing.T) {
t.Run("ValidPath", func(t *testing.T) { t.Run("ValidPath", func(t *testing.T) {
assert.Equal(t, "/go/src/github.com/photoprism/photoprism", Path("/go/src/github.com/photoprism/photoprism")) assert.Equal(t, ProjectRoot, Path(ProjectRoot))
}) })
t.Run("ValidFile", func(t *testing.T) { t.Run("ValidFile", func(t *testing.T) {
assert.Equal(t, "filename.TXT", Path("filename.TXT")) assert.Equal(t, "filename.TXT", Path("filename.TXT"))