feat(usage): split throttle thresholds per bucket, add draggable gauge markers
This commit is contained in:
@@ -43,6 +43,33 @@ public class SettingsModalViewModelTests
|
||||
SessionSkills: null, ModelPresets: null,
|
||||
UsageGateFiveHourPct: fiveHourPct, UsageGateSevenDayPct: sevenDayPct);
|
||||
|
||||
[Fact]
|
||||
public async Task Save_carries_dragged_throttle_stages_through_untouched()
|
||||
{
|
||||
// The throttle stages are only editable by dragging the usage-monitor gauges. Saving the
|
||||
// Settings modal rebuilds the whole DTO, so it must not reset them to the defaults.
|
||||
var worker = new FakeWorker
|
||||
{
|
||||
AppToReturn = DtoWith(65, 95) with
|
||||
{
|
||||
UsageThrottleFiveHourSoftPct = 42,
|
||||
UsageThrottleFiveHourHardPct = 58,
|
||||
UsageThrottleSevenDaySoftPct = 71,
|
||||
UsageThrottleSevenDayHardPct = 88,
|
||||
},
|
||||
};
|
||||
var vm = MakeVm(worker);
|
||||
await vm.LoadAsync();
|
||||
|
||||
await vm.SaveCommand.ExecuteAsync(null);
|
||||
|
||||
Assert.NotNull(worker.Saved);
|
||||
Assert.Equal(42, worker.Saved!.UsageThrottleFiveHourSoftPct);
|
||||
Assert.Equal(58, worker.Saved.UsageThrottleFiveHourHardPct);
|
||||
Assert.Equal(71, worker.Saved.UsageThrottleSevenDaySoftPct);
|
||||
Assert.Equal(88, worker.Saved.UsageThrottleSevenDayHardPct);
|
||||
}
|
||||
|
||||
private static SettingsModalViewModel MakeVm(FakeWorker worker) =>
|
||||
new(worker, new PrimeClaudeTabViewModel(new FakePrimeApi()), new OnlineLoginService(),
|
||||
MakeLocalizer(), new AppSettings());
|
||||
|
||||
Reference in New Issue
Block a user