19 lines
604 B
Go
19 lines
604 B
Go
package main
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestgetSpotifyAuthURL(t *testing.T) {
|
|
// The result of this call is a serialized SpotifyToken struct
|
|
// The data is dynamic so we can't easily check it but we validate types/fields
|
|
res, err := getSpotifyToken(spotifyClientID, spotifyClientSecret)
|
|
if err != nil {
|
|
assert.Fail(t, err.Error())
|
|
}
|
|
testRes := &SpotifyToken{AccessToken: "example", TokenType: "Bearer", ExpiresIn: 100}
|
|
assert.IsType(t, testRes, res)
|
|
// This should always be "Bearer" according to spotify docs
|
|
assert.Equal(t, "Bearer", res.TokenType)
|
|
}
|