fix(localdb): DI review fixes — onReady leak guard, BusyTimeoutMs ctor guard, shared allow-list

This commit is contained in:
Joseph Doherty
2026-07-17 21:47:28 -04:00
parent 529585163c
commit 4f9982c53f
6 changed files with 53 additions and 12 deletions
@@ -56,6 +56,21 @@ public sealed class DependencyInjectionTests : IDisposable
Assert.Contains("widget", db.ReplicatedTables.Keys);
}
[Fact]
public void AddZbLocalDb_OnReadyThrows_ExceptionPropagates()
{
var services = new ServiceCollection();
services.AddZbLocalDb(Config(), _ => throw new InvalidOperationException("boom"));
using var provider = services.BuildServiceProvider();
var first = Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<ILocalDb>());
Assert.Equal("boom", first.Message);
// No half-initialized singleton is cached: the next resolution re-runs the factory and fails again.
var second = Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<ILocalDb>());
Assert.Equal("boom", second.Message);
}
[Fact]
public void Validator_EmptyPath_Fails()
{