Files
Delta-v/Content.IntegrationTests/Tests/Station/JobTests.cs
T
Moony 6656adc083 Gametest Part 2: Preliminary refactor every test to use GameTest as the framework. (#43207)
* Pass 1.

* i'm FREE

* Prevent hangups.

* okay fine here's an attribute for settings, will polish later and prolly remove the overridable thing.

* sigh.

* fix singular trigger bug so LatheTest doesn't flake.

* Remove SystemAttribute usage.

* Poke

* I used the shotgun. You know why? Cause the shot gun doesn’t miss, and unlike the shitty hybrid taser it stops a criminal in their tracks in two hits. Bang, bang, and they’re fucking done. I use four shots just to make damn sure. Because, once again, I’m not there to coddle a buncha criminal scum sucking f------, I’m there to 1) Survive the fucking round. 2) Guard the armory. So you can absolutely get fucked. If I get unbanned, which I won’t, you can guarantee I will continue to use the shotgun to apprehend criminals. Because it’s quick, clean and effective as fuck. Why in the seven hells would I fuck around with the disabler shots, which take half a clip just to bring someone down, or with the tazer bolts which are slow as balls, impossible to aim and do about next to jack shit, fuck all. The shotgun is the superior law enforcement weapon. Because it stops crime. And it stops crime by reducing the number of criminals roaming the fucking halls.

* Change the faulty store test into two tests, one of which is ignored for failing.
2026-06-29 12:44:18 +02:00

49 lines
1.7 KiB
C#

using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Robust.Shared.Prototypes;
using System.Linq;
using Content.IntegrationTests.Fixtures;
namespace Content.IntegrationTests.Tests.Station;
[TestFixture]
[TestOf(typeof(SharedJobSystem))]
public sealed class JobTest : GameTest
{
/// <summary>
/// Ensures that every job belongs to at most 1 primary department.
/// Having no primary department is ok.
/// </summary>
[Test]
public async Task PrimaryDepartmentsTest()
{
var pair = Pair;
var server = pair.Server;
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
await server.WaitAssertion(() =>
{
// only checking primary departments so don't bother with others
var departments = prototypeManager.EnumeratePrototypes<DepartmentPrototype>()
.Where(department => department.Primary)
.ToList();
var jobs = prototypeManager.EnumeratePrototypes<JobPrototype>();
foreach (var job in jobs)
{
// not actually using the jobs system since that will return the first department
// and we need to test that there is never more than 1, so it not sorting them is correct
var primaries = 0;
foreach (var department in departments)
{
if (!department.Roles.Contains(job.ID))
continue;
primaries++;
Assert.That(primaries, Is.EqualTo(1), $"The job {job.ID} has more than 1 primary department!");
}
}
});
}
}