feat: harden recording lifecycle and refresh fnOS UI
This commit is contained in:
@@ -63,6 +63,34 @@ public sealed class SystemSettingsServiceTests
|
||||
Assert.Contains(allSettings, static item => item.Key == "platform_request.twitch.cookie" && item.Value == "auth-token=123");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task StorageThresholds_NormalizeUnsafeLegacyValuesAndKeepSafetyGap()
|
||||
{
|
||||
var repository = new InMemoryAppSettingRepository(
|
||||
[
|
||||
new AppSetting("storage.guard.green_threshold_percent", "5", DateTimeOffset.UtcNow),
|
||||
new AppSetting("storage.guard.red_threshold_percent", "1", DateTimeOffset.UtcNow)
|
||||
]);
|
||||
var service = new SystemSettingsService(repository, new NoOpUnitOfWork());
|
||||
|
||||
var settings = await service.GetAsync();
|
||||
|
||||
Assert.Equal(10, settings.StorageGreenThresholdPercent);
|
||||
Assert.Equal(5, settings.StorageRedThresholdPercent);
|
||||
|
||||
var request = new Application.Models.Settings.UpdateSystemSettingsRequest
|
||||
{
|
||||
StorageGreenThresholdPercent = 20,
|
||||
StorageRedThresholdPercent = 19,
|
||||
PlatformRequestSettings = Application.Models.Settings.SystemSettingsDto.CreatePlatformRequestSettingsMap()
|
||||
};
|
||||
await service.UpdateAsync(request);
|
||||
|
||||
var updated = await service.GetAsync();
|
||||
Assert.Equal(20, updated.StorageGreenThresholdPercent);
|
||||
Assert.Equal(15, updated.StorageRedThresholdPercent);
|
||||
}
|
||||
|
||||
private sealed class InMemoryAppSettingRepository : IAppSettingRepository
|
||||
{
|
||||
private readonly Dictionary<string, AppSetting> _items;
|
||||
|
||||
Reference in New Issue
Block a user