fix(wizard): an empty token box asks for a token instead of showing a raw error #173

Merged
james.maes merged 1 commits from fix/172-wizard-empty-token into main 2026-11-11 02:03:09 +00:00
2 changed files with 27 additions and 0 deletions

No files matched your search

@@ -280,6 +280,26 @@ public sealed class AccountWizardViewModelTests : IDisposable
[Theory]
[InlineData("")]
[InlineData(" ")]
public async Task TryAdvance_WithNoTokenTyped_AsksForOne_AndAsksNothingOfTheServer(string typed)
{
AccountWizardViewModel wizard = NewWizard();
wizard.Name = "Work";
await AdvanceToStepAsync(wizard, 2);
wizard.Token = typed;
Assert.False(await wizard.TryAdvanceAsync());
Assert.Equal(2, wizard.Step);
Assert.Equal("Enter a token to continue.", wizard.TokenError);
Assert.False(wizard.IsValidatingToken);
Assert.Equal(0, _orgs.Calls);
}
[Fact]
public async Task TryAdvance_RejectedToken_SetsTokenErrorAndStays()
{
@@ -368,6 +368,13 @@ public sealed partial class AccountWizardViewModel : ObservableObject
return false;
}
}
else if(candidate.Length == 0)
{
// Nothing to check: say so here, instead of asking the server
// and showing its argument error (#172).
TokenError = "Enter a token to continue.";
return false;
}
}
IsValidatingToken = true;