Add integration test for MobPriceComponent (#39524)

Test
This commit is contained in:
Winkarst-cpu
2025-08-15 08:46:27 +03:00
committed by GitHub
parent 7a3026b4f8
commit 2b91f965a2
2 changed files with 25 additions and 1 deletions

View File

@@ -5,7 +5,9 @@ using Content.Server.Cargo.Components;
using Content.Server.Cargo.Systems; using Content.Server.Cargo.Systems;
using Content.Server.Nutrition.Components; using Content.Server.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems; using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Body.Components;
using Content.Shared.Cargo.Prototypes; using Content.Shared.Cargo.Prototypes;
using Content.Shared.Mobs.Components;
using Content.Shared.Prototypes; using Content.Shared.Prototypes;
using Content.Shared.Stacks; using Content.Shared.Stacks;
using Content.Shared.Whitelist; using Content.Shared.Whitelist;
@@ -250,4 +252,26 @@ public sealed class CargoTest
await pair.CleanReturnAsync(); await pair.CleanReturnAsync();
} }
[Test]
public async Task MobPrice()
{
await using var pair = await PoolManager.GetServerClient();
var componentFactory = pair.Server.ResolveDependency<IComponentFactory>();
await pair.Server.WaitAssertion(() =>
{
Assert.Multiple(() =>
{
foreach (var (proto, comp) in pair.GetPrototypesWithComponent<MobPriceComponent>())
{
Assert.That(proto.TryGetComponent<BodyComponent>(out _, componentFactory), $"Found MobPriceComponent on {proto.ID}, but no BodyComponent!");
Assert.That(proto.TryGetComponent<MobStateComponent>(out _, componentFactory), $"Found MobPriceComponent on {proto.ID}, but no MobStateComponent!");
}
});
});
await pair.CleanReturnAsync();
}
} }

View File

@@ -198,7 +198,7 @@
sprite: Clothing/Head/Misc/fancycrown.rsi sprite: Clothing/Head/Misc/fancycrown.rsi
- type: TypingIndicatorClothing - type: TypingIndicatorClothing
proto: regal proto: regal
- type: MobPrice - type: StaticPrice
price: 3000 price: 3000
- type: AddAccentClothing - type: AddAccentClothing
accent: MobsterAccent accent: MobsterAccent