feat(offline): bundle local assets and add safe UI error recovery (U16)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Bunit;
|
||||
using Duempelkas.App.Components;
|
||||
using Duempelkas.App.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Rendering;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit;
|
||||
|
||||
namespace Duempelkas.Tests;
|
||||
|
||||
public class ErrorRecoveryTests
|
||||
{
|
||||
[Fact]
|
||||
public void UnexpectedError_OffersRecoveryWithoutLeakingBookingData()
|
||||
{
|
||||
using var context = new BunitContext();
|
||||
context.Services.AddSingleton<ToastService>();
|
||||
var boundary = context.Render<AppErrorBoundary>(p => p.AddChildContent<Throws>());
|
||||
boundary.WaitForAssertion(() => Assert.Contains("nicht bestätigt", boundary.Markup));
|
||||
Assert.Contains("Zur Kontenübersicht", boundary.Markup);
|
||||
Assert.Contains("InvalidOperationException", boundary.Markup);
|
||||
Assert.DoesNotContain("SECRET_BOOKING_DATA", boundary.Markup);
|
||||
}
|
||||
private sealed class Throws : ComponentBase
|
||||
{
|
||||
protected override void BuildRenderTree(RenderTreeBuilder builder) => throw new InvalidOperationException("SECRET_BOOKING_DATA");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user