Three usability-audit findings in Settings: - An unparseable PowerUse window (e.g. "9:0") used to save silently as null (= round the clock), the opposite of what the typo implied. Validate() now rejects an unparseable start/end unless blank; the worker-side read-time tolerance is unchanged. - "Effort" column header gets a tooltip explaining it's the model's reasoning effort (cost/depth tradeoff). - The "Prime Claude" tab gets a tooltip explaining scheduled Claude runs (Ping / Fill My Day / custom prompt). New locale keys added to en+de. Updated the PowerUse round-trip test that asserted the old silent-normalize behavior.
61 lines
1.8 KiB
C#
61 lines
1.8 KiB
C#
using ClaudeDo.Ui.ViewModels.Modals.Settings;
|
|
using Xunit;
|
|
|
|
namespace ClaudeDo.Ui.Tests.ViewModels;
|
|
|
|
public class GeneralSettingsTabViewModelTests
|
|
{
|
|
[Theory]
|
|
[InlineData(-1, false)]
|
|
[InlineData(0, true)]
|
|
[InlineData(80, true)]
|
|
[InlineData(100, true)]
|
|
[InlineData(101, false)]
|
|
public void Validate_UsageGateFiveHourPct_bounds(int value, bool expectedValid)
|
|
{
|
|
var vm = new GeneralSettingsTabViewModel { UsageGateFiveHourPct = value };
|
|
|
|
Assert.Equal(expectedValid, vm.Validate() is null);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(-1, false)]
|
|
[InlineData(0, true)]
|
|
[InlineData(80, true)]
|
|
[InlineData(100, true)]
|
|
[InlineData(101, false)]
|
|
public void Validate_UsageGateSevenDayPct_bounds(int value, bool expectedValid)
|
|
{
|
|
var vm = new GeneralSettingsTabViewModel { UsageGateSevenDayPct = value };
|
|
|
|
Assert.Equal(expectedValid, vm.Validate() is null);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null, true)]
|
|
[InlineData("", true)]
|
|
[InlineData("09:00", true)]
|
|
[InlineData("23:59", true)]
|
|
[InlineData("9:0", false)]
|
|
[InlineData("abc", false)]
|
|
[InlineData("25:00", false)]
|
|
public void Validate_PowerUseWindowStart_rejectsUnparseable(string? value, bool expectedValid)
|
|
{
|
|
var vm = new GeneralSettingsTabViewModel { PowerUseWindowStart = value };
|
|
|
|
Assert.Equal(expectedValid, vm.Validate() is null);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null, true)]
|
|
[InlineData("09:00", true)]
|
|
[InlineData("9:0", false)]
|
|
[InlineData("abc", false)]
|
|
public void Validate_PowerUseWindowEnd_rejectsUnparseable(string? value, bool expectedValid)
|
|
{
|
|
var vm = new GeneralSettingsTabViewModel { PowerUseWindowEnd = value };
|
|
|
|
Assert.Equal(expectedValid, vm.Validate() is null);
|
|
}
|
|
}
|