Fix route tests

This commit is contained in:
froge 2025-02-14 06:26:38 +10:00
parent 034c4e1088
commit f7132c06fc
Signed by: froge
GPG key ID: A825E09930271BFA

View file

@ -36,13 +36,13 @@ func TestGetArtistByIDRoute(t *testing.T) {
// Dynamic data is hard to test so here we validate JSON response
// And we check known fields which are not likely to change
// We then check that the DB was updated correctly just to be sure
var spotifyResp SpotifyResponse
err := json.NewDecoder(w.Body).Decode(&spotifyResp)
var resp ArtistProfile
err := json.NewDecoder(w.Body).Decode(&resp)
if err != nil {
assert.Fail(t, fmt.Sprintf("Could not validate and parse JSON response into SpotifyResponse struct: %s", err.Error()))
}
assert.Equal(t, "0TnOYISbd1XYRBk9myaseg", spotifyResp.ID)
assert.Equal(t, "Pitbull", spotifyResp.Name)
assert.Equal(t, "0TnOYISbd1XYRBk9myaseg", resp.SpotifyID)
assert.Equal(t, "Pitbull", resp.Name)
var artist ArtistProfile
dbResult := env.db.Take(&artist)