Battlepass fix
This commit is contained in:
@@ -105,6 +105,33 @@ public class BattlePassControllerInfoTests
|
||||
Assert.That(premiumReward.GetProperty("is_received").GetBoolean(), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Info_can_purchase_is_false_when_viewer_already_premium()
|
||||
{
|
||||
using var factory = new SVSimTestFactory();
|
||||
long viewerId = await factory.SeedViewerAsync();
|
||||
await SeedSeason23WithRewards(factory);
|
||||
|
||||
using (var scope = factory.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<SVSimDbContext>();
|
||||
db.ViewerBattlePassProgress.Add(new ViewerBattlePassProgressEntry
|
||||
{
|
||||
ViewerId = viewerId, SeasonId = 23, CurrentPoint = 0, IsPremium = true,
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
using var client = factory.CreateAuthenticatedClient(viewerId);
|
||||
var response = await client.PostAsync("/battle_pass/info", JsonBody(EmptyAuthBody));
|
||||
var body = await response.Content.ReadAsStringAsync();
|
||||
using var doc = JsonDocument.Parse(body);
|
||||
|
||||
Assert.That(doc.RootElement.GetProperty("season_info").GetProperty("can_purchase").GetBoolean(),
|
||||
Is.False,
|
||||
"premium owners must see can_purchase=false (client uses it as the sole hide-buy-button signal)");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Info_returns_empty_payload_outside_any_season_window()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user