Skip to content

Commit

Permalink
Add tests for feedback encode
Browse files Browse the repository at this point in the history
  • Loading branch information
lyarenei committed Nov 11, 2023
1 parent 97df66c commit d77962b
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.ObjectModel;
using Jellyfin.Plugin.ListenBrainz.Api.Models;
using Jellyfin.Plugin.ListenBrainz.Api.Models.Requests;
using Jellyfin.Plugin.ListenBrainz.Api.Resources;
using Newtonsoft.Json;
using Xunit;

Expand Down Expand Up @@ -40,3 +42,20 @@ public void Listen_EncodeAndDecode()
Assert.NotNull(deserializedListen);
}
}

public class RecordingFeedbackTests
{
[Theory]
[InlineData(FeedbackScore.Hated)]
[InlineData(FeedbackScore.Loved)]
[InlineData(FeedbackScore.Neutral)]
public void FeedbackValues_Encode(FeedbackScore score)
{
var request = new RecordingFeedbackRequest { Score = score };
var actualJson = JsonConvert.SerializeObject(request, BaseClient.SerializerSettings);
Assert.NotNull(actualJson);

var expectedJson = @"{""score"":" + (int)score + "}";
Assert.Equal(expectedJson, actualJson);
}
}

0 comments on commit d77962b

Please sign in to comment.