using Newtonsoft.Json.Linq; using XFEWarframe.Core; using Xunit; namespace XFEWarframe.Tests; public sealed partial class EngineTests { [Fact] public async Task ServerNameIsAdminOnlyPersistsAndAppearsInPublicStatusAndGameNews() { const string name = "星际测试服"; Assert.Equal(401, (await Call("/control/v1/config", new { serverName = name })).Status); Assert.Equal(200, (await Call("/control/v1/config", new { serverName = name }, admin: true)).Status); Assert.Equal(400, (await Call("/control/v1/config", new { serverName = "bad\nname" }, admin: true)).Status); Assert.Equal(400, (await Call("/control/v1/config", new { serverName = "" }, admin: true)).Status); await store.DisposeAsync(); store = new(root); engine = new(store, options); var health = JObject.Parse((await Call("/health")).Body); Assert.Equal(3, health.Value("apiVersion")); Assert.Equal(name, health.Value("serverName")); Assert.Equal(options.GamePublicUrl, health.Value("gameUrl")); Assert.DoesNotContain(options.AdminToken, health.ToString()); Assert.Equal(name, JObject.Parse((await Portal("info")).Body).Value("serverName")); Assert.Contains(JObject.Parse((await Call("/dynamic/worldState.php")).Body)["Events"]!, x => x.Value("Msg") == "XFEWarframe · " + name); } }