mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
code refactor
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package avatars
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/mayswind/ezbookkeeping/pkg/models"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/settings"
|
||||
)
|
||||
|
||||
func TestInternalStorageAvatarProvider_GetAvatarUrl(t *testing.T) {
|
||||
avatarProvider := NewInternalStorageAvatarProvider(&settings.Config{
|
||||
RootUrl: "https://foo.bar/",
|
||||
})
|
||||
|
||||
expectedValue := "https://foo.bar/avatar/1234567890.jpg"
|
||||
actualValue := avatarProvider.GetAvatarUrl(&models.User{
|
||||
Uid: 1234567890,
|
||||
CustomAvatarType: "jpg",
|
||||
})
|
||||
|
||||
assert.Equal(t, expectedValue, actualValue)
|
||||
}
|
||||
|
||||
func TestInternalStorageAvatarProvider_GetAvatarUrl_EmptyCustomAvatarType(t *testing.T) {
|
||||
avatarProvider := NewInternalStorageAvatarProvider(&settings.Config{
|
||||
RootUrl: "https://foo.bar/",
|
||||
})
|
||||
|
||||
expectedValue := ""
|
||||
actualValue := avatarProvider.GetAvatarUrl(&models.User{
|
||||
Uid: 1234567890,
|
||||
CustomAvatarType: "",
|
||||
})
|
||||
|
||||
assert.Equal(t, expectedValue, actualValue)
|
||||
}
|
||||
Reference in New Issue
Block a user