Allow unlimited joker suggestions when granted repeatedly
This commit is contained in:
@@ -241,7 +241,7 @@ public class SuggestionTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Joker_allows_sixth_suggestion_but_blocks_seventh()
|
||||
public async Task Joker_allows_unlimited_extra_suggestions_when_granted_multiple_times()
|
||||
{
|
||||
using var factory = new TestWebApplicationFactory();
|
||||
var client = factory.CreateClientWithCookies();
|
||||
@@ -286,6 +286,14 @@ public class SuggestionTests
|
||||
});
|
||||
sixth.EnsureSuccessStatusCode();
|
||||
|
||||
// Grant another joker and add a seventh suggestion
|
||||
await factory.WithDbContextAsync(async db =>
|
||||
{
|
||||
var p = await db.Players.FirstAsync();
|
||||
p.HasJoker = true;
|
||||
await db.SaveChangesAsync();
|
||||
});
|
||||
|
||||
var seventh = await client.PostAsJsonAsync("/api/suggestions", new
|
||||
{
|
||||
Name = "TooMany",
|
||||
@@ -298,7 +306,22 @@ public class SuggestionTests
|
||||
MaxPlayers = (int?)null
|
||||
});
|
||||
|
||||
Assert.Equal(HttpStatusCode.BadRequest, seventh.StatusCode);
|
||||
seventh.EnsureSuccessStatusCode();
|
||||
|
||||
// No joker left; further suggestions should be blocked
|
||||
var eighth = await client.PostAsJsonAsync("/api/suggestions", new
|
||||
{
|
||||
Name = "BlockedNow",
|
||||
Genre = (string?)null,
|
||||
Description = (string?)null,
|
||||
ScreenshotUrl = (string?)null,
|
||||
YoutubeUrl = (string?)null,
|
||||
GameUrl = (string?)null,
|
||||
MinPlayers = (int?)null,
|
||||
MaxPlayers = (int?)null
|
||||
});
|
||||
|
||||
Assert.Equal(HttpStatusCode.BadRequest, eighth.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user