Record slice 1 recheck after clothing, session and social.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -83,6 +83,51 @@ public class ServiceabilityTests(AppHostFixture fixture)
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MissingModFolder_LeavesTheSchoolUnstartedAndTheFileUntouched()
|
||||
{
|
||||
using var client = fixture.App.CreateHttpClient("server");
|
||||
await SchoolApiTests.ResetAsync(client);
|
||||
var created = await SchoolApiTests.CreateAsync(client, "Без папки мода", TuesdayMorning);
|
||||
var directory = await SavesDirectoryAsync(client);
|
||||
var path = Path.Combine(directory, $"{created.Id}.json");
|
||||
var node = JsonNode.Parse(File.ReadAllText(path))
|
||||
?? throw new InvalidOperationException($"Save {path} parsed to nothing.");
|
||||
var mods = node["modIds"] as JsonArray
|
||||
?? throw new InvalidOperationException($"Save {path} has no modIds.");
|
||||
mods.Add("missing-pack-slice1-recheck");
|
||||
var patched = node.ToJsonString(new JsonSerializerOptions { WriteIndented = true });
|
||||
|
||||
try
|
||||
{
|
||||
await SchoolApiTests.ResetAsync(client);
|
||||
File.WriteAllText(path, patched);
|
||||
var before = File.ReadAllBytes(path);
|
||||
|
||||
using var reload = await client.PostAsync("/api/dev/reload-schools", content: null, TestContext.Current.CancellationToken);
|
||||
reload.EnsureSuccessStatusCode();
|
||||
|
||||
Assert.Equal(before, File.ReadAllBytes(path));
|
||||
|
||||
var state = await SchoolApiTests.GetSchoolsAsync(client);
|
||||
var mine = state.Schools.FirstOrDefault(school => school.Id == created.Id);
|
||||
var other = state.Others.FirstOrDefault(school => school.Id == created.Id);
|
||||
Assert.True(mine is not null || other is not null);
|
||||
Assert.False(mine?.Running ?? other?.Running ?? true);
|
||||
|
||||
using var people = await client.GetAsync(
|
||||
$"/api/schools/{created.Id}/people?pageSize=1",
|
||||
TestContext.Current.CancellationToken);
|
||||
Assert.Equal(HttpStatusCode.NotFound, people.StatusCode);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeleteSchoolFiles(directory, created.Id);
|
||||
using var cleanup = await client.PostAsync("/api/dev/reload-schools", content: null, TestContext.Current.CancellationToken);
|
||||
cleanup.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Dump_ReturnsPeopleNodesAndTimetable()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user