From 652fa283a1152cefa9b7191e89b52d031291de7d Mon Sep 17 00:00:00 2001 From: monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Sun, 4 Feb 2024 13:12:05 +0330 Subject: [PATCH] use filepath for correct path in unittest --- internal/core/processing_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/core/processing_test.go b/internal/core/processing_test.go index 89f7cf2dc4..bc222453cb 100644 --- a/internal/core/processing_test.go +++ b/internal/core/processing_test.go @@ -5,6 +5,7 @@ import ( "context" "net/http" "net/http/httptest" + "path/filepath" "testing" "github.com/go-shiori/shiori/internal/core" @@ -45,6 +46,7 @@ func TestDownloadBookImage(t *testing.T) { assert.True(t, deps.Domains.Storage.FileExists(dstFile)) }) t.Run("successful download medium size image", func(t *testing.T) { + tempDir := t.TempDir() // create a file server handler for the 'testdata' directory fs := http.FileServer(http.Dir("../../testdata/")) @@ -54,7 +56,7 @@ func TestDownloadBookImage(t *testing.T) { // Arrange imageURL := server.URL + "/medium_image.png" - dstFile := "tempDir/medium_image.png" + dstFile := filepath.Join(tempDir, "medium_image.png") // Act err := core.DownloadBookImage(deps, imageURL, dstFile)