SourceSink: a habitation module's table is a sink, and a consumer good is judged as every good is (cut habitation-gear)

The consumer-good skip of the sink half is deleted; the test that pinned the skip becomes ModuleTableIsASink.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-28 23:19:45 +01:00
commit 40c335a200
2 changed files with 25 additions and 5 deletions

View file

@ -229,11 +229,30 @@ public sealed class EconomyChecksTests
}
[Fact]
public void SourceSinkLeavesAConsumerGoodWithoutASink()
public void ModuleTableIsASink()
{
// A consumer good is judged as every good is (ruling installed-gear-decides-what-a-station-buys): it has a sink only while
// some design's habitation table names it, offered or not.
using var f = EconomyFixture.Healthy();
f.Good("kettle", roles: new[] { ("Plate", 1) });
Assert.Empty(EconomyChecks.SourceSink(f.Cache));
var key = new CultRecordKey("gear:quarters");
var kettle = EconomyFixture.Item(EconomyFixture.Key("kettle"));
IEnumerable<string> NoSink() => EconomyChecks.SourceSink(f.Cache).Where(x => x.Message.Contains("no sink")).Select(x => x.Record);
Assert.Equal(new[] { "recipe:commodity:kettle" }, NoSink());
f.Cache.Upsert(typeof(GearData), new GearData
{
Name = "Quarters", Hardpoint = HardpointType.Tool, Shape = new Shape(), Price = 1,
Behaviors = { new HabitationData { Capacity = 5, Table = { new HabitationRow { Commodity = kettle, PerOccupantHour = 1 } } } }
}, key);
Assert.Empty(NoSink());
f.Cache.Upsert(typeof(GearData), new GearData
{
Name = "Quarters", Hardpoint = HardpointType.Tool, Shape = new Shape(), Price = 1,
Behaviors = { new HabitationData { Capacity = 5 } }
}, key);
Assert.Equal(new[] { "recipe:commodity:kettle" }, NoSink());
}
[Fact]