Add Job preference tests (#28625)

* Misc Job related changes

* Add JobTest

* A

* Aa

* Lets not confuse the yaml linter

* fixes

* a
This commit is contained in:
Leon Friedrich
2024-06-06 02:19:24 +12:00
committed by GitHub
parent e1541351a5
commit adeed705e6
44 changed files with 538 additions and 262 deletions

View File

@@ -245,22 +245,15 @@ namespace Content.IntegrationTests.Tests
// Test all availableJobs have spawnPoints
// This is done inside gamemap test because loading the map takes ages and we already have it.
var jobList = entManager.GetComponent<StationJobsComponent>(station).RoundStartJobList
.Where(x => x.Value != 0)
.Select(x => x.Key);
var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
.Where(spawnpoint => spawnpoint.SpawnType == SpawnPointType.Job)
.Select(spawnpoint => spawnpoint.Job.ID)
.Distinct();
List<string> missingSpawnPoints = new();
foreach (var spawnpoint in jobList.Except(spawnPoints))
{
if (protoManager.Index<JobPrototype>(spawnpoint).SetPreference)
missingSpawnPoints.Add(spawnpoint);
}
var comp = entManager.GetComponent<StationJobsComponent>(station);
var jobs = new HashSet<ProtoId<JobPrototype>>(comp.SetupAvailableJobs.Keys);
Assert.That(missingSpawnPoints, Has.Count.EqualTo(0),
$"There is no spawnpoint for {string.Join(", ", missingSpawnPoints)} on {mapProto}.");
var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
.Where(x => x.SpawnType == SpawnPointType.Job)
.Select(x => x.Job!.Value);
jobs.ExceptWith(spawnPoints);
Assert.That(jobs, Is.Empty,$"There is no spawnpoints for {string.Join(", ", jobs)} on {mapProto}.");
}
try