Simple tests for Backend.FromConfig implementations

This commit is contained in:
Philipp Wolfer 2023-11-12 17:51:15 +01:00
parent aa01ae1342
commit c4ae2eda48
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
4 changed files with 61 additions and 0 deletions

View file

@ -25,10 +25,18 @@ import (
"testing"
"time"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
"go.uploadedlobster.com/scotty/backends/maloja"
)
func TestFromConfig(t *testing.T) {
config := viper.New()
config.Set("token", "thetoken")
backend := maloja.MalojaApiBackend{}.FromConfig(config)
assert.IsType(t, maloja.MalojaApiBackend{}, backend)
}
func TestScrobbleToListen(t *testing.T) {
scrobble := maloja.Scrobble{
ListenedAt: 1699289873,