Skip to content

Commit ee227cf

Browse files
committed
Fix windows test
1 parent 4a37f83 commit ee227cf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

utils/image/base64converter_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ func TestToBase64WithBaseDir_EmptyBaseDir(t *testing.T) {
248248
func TestResolveImagePath(t *testing.T) {
249249
absolutePath := filepath.Join(string(filepath.Separator), "absolute", "path.png")
250250
baseDir := filepath.Join(string(filepath.Separator), "base", "dir")
251-
expectedWithBase := filepath.Join(string(filepath.Separator), "base", "dir", "images", "pic.png")
252-
expectedCurrentDir := filepath.Join(string(filepath.Separator), "base", "dir", "pic.png")
253-
expectedParentDir := filepath.Join(string(filepath.Separator), "base", "pic.png")
251+
relativePath := filepath.Join("images", "pic.png")
254252

255253
tests := []struct {
256254
name string
@@ -259,10 +257,10 @@ func TestResolveImagePath(t *testing.T) {
259257
expected string
260258
}{
261259
{"absolute path", absolutePath, baseDir, absolutePath},
262-
{"relative path with base", "images/pic.png", baseDir, expectedWithBase},
263-
{"relative path no base", "images/pic.png", "", "images/pic.png"},
264-
{"current dir relative", "./pic.png", baseDir, expectedCurrentDir},
265-
{"parent dir relative", "../pic.png", baseDir, expectedParentDir},
260+
{"relative path with base", relativePath, baseDir, filepath.Join(baseDir, relativePath)},
261+
{"relative path no base", relativePath, "", relativePath},
262+
{"current dir relative", filepath.Join(".", "pic.png"), baseDir, filepath.Join(baseDir, "pic.png")},
263+
{"parent dir relative", filepath.Join("..", "pic.png"), baseDir, filepath.Join(baseDir, "..", "pic.png")},
266264
}
267265

268266
for _, test := range tests {

0 commit comments

Comments
 (0)