mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
feat: Implement consumables support in StoreService and add related tests; include new consumables data
This commit is contained in:
@@ -61,6 +61,36 @@ public sealed class WatchShop2023Tests : IClassFixture<DorkNetServerFactory>
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Storefront_includes_food_consumables_with_literal_desc()
|
||||
{
|
||||
using var client = ApiClient();
|
||||
var storefront = await GetJsonAsync(client, "/api/storefronts/v3/giftdropstore/3");
|
||||
var rows = storefront.GetProperty("StoreItems");
|
||||
|
||||
// Every consumable tile carries a bracketed ConsumableItemDesc (the
|
||||
// client's literal item key) and no avatar item — that's what routes
|
||||
// it to the Shop's Consumables tab and binds the baked prefab.
|
||||
var consumables = new List<string>();
|
||||
foreach (var row in rows.EnumerateArray())
|
||||
{
|
||||
var gd = row.GetProperty("GiftDrop");
|
||||
var desc = gd.GetProperty("ConsumableItemDesc").GetString() ?? "";
|
||||
if (desc.StartsWith("[") || desc.StartsWith("("))
|
||||
{
|
||||
consumables.Add(desc);
|
||||
// Consumables are not avatar items: AvatarItemDesc empty and
|
||||
// AvatarItemType null (a non-null enum here would tab it as
|
||||
// clothing).
|
||||
Assert.Equal("", gd.GetProperty("AvatarItemDesc").GetString());
|
||||
Assert.Equal(JsonValueKind.Null, gd.GetProperty("AvatarItemType").ValueKind);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.Contains("[FoodConsumable_RootBeer]", consumables);
|
||||
Assert.Contains("[KOConsumable_Cola]", consumables);
|
||||
}
|
||||
|
||||
private HttpClient ApiClient()
|
||||
{
|
||||
var client = _factory.CreateClient(new() { AllowAutoRedirect = false });
|
||||
|
||||
Reference in New Issue
Block a user