Skip to content

Commit

Permalink
use filepath for correct path in unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
Monirzadeh committed Feb 4, 2024
1 parent f3a7c00 commit 652fa28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/core/processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"net/http"
"net/http/httptest"
"path/filepath"
"testing"

"github.com/go-shiori/shiori/internal/core"
Expand Down Expand Up @@ -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/"))

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

0 comments on commit 652fa28

Please sign in to comment.