mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-15 09:43:01 +03:00
fix: decouple images from app config service (#965)
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
@@ -2,8 +2,36 @@ package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSplitFileName(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
fullName string
|
||||
wantName string
|
||||
wantExt string
|
||||
}{
|
||||
{"background.jpg", "background", "jpg"},
|
||||
{"archive.tar.gz", "archive.tar", "gz"},
|
||||
{".gitignore", ".gitignore", ""},
|
||||
{"noext", "noext", ""},
|
||||
{"a.b.c", "a.b", "c"},
|
||||
{".hidden.ext", ".hidden", "ext"},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.fullName, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
name, ext := SplitFileName(tc.fullName)
|
||||
assert.Equal(t, tc.wantName, name)
|
||||
assert.Equal(t, tc.wantExt, ext)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetFileExtension(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user