feat: add system account ($SYS) and server NKey identity stubs

This commit is contained in:
Joseph Doherty
2026-02-22 23:39:22 -05:00
parent 086b4f50e8
commit 600c6f9e5a
2 changed files with 35 additions and 0 deletions

View File

@@ -525,3 +525,25 @@ public class CloseReasonTests : IAsyncLifetime
natsClient.CloseReason.ShouldBe(ClosedState.ClientClosed);
}
}
public class ServerIdentityTests
{
[Fact]
public void Server_creates_system_account()
{
var server = new NatsServer(new NatsOptions { Port = 0 }, NullLoggerFactory.Instance);
server.SystemAccount.ShouldNotBeNull();
server.SystemAccount.Name.ShouldBe("$SYS");
server.Dispose();
}
[Fact]
public void Server_generates_nkey_identity()
{
var server = new NatsServer(new NatsOptions { Port = 0 }, NullLoggerFactory.Instance);
server.ServerNKey.ShouldNotBeNullOrEmpty();
// Server NKey public keys start with 'N'
server.ServerNKey[0].ShouldBe('N');
server.Dispose();
}
}