Files
natsdotnet/tests/NATS.Server.Tests/WebSocket/WebSocketOptionsTests.cs
Joseph Doherty c30e67a69d Fix E2E test gaps and add comprehensive E2E + parity test suites
- Fix pull consumer fetch: send original stream subject in HMSG (not inbox)
  so NATS client distinguishes data messages from control messages
- Fix MaxAge expiry: add background timer in StreamManager for periodic pruning
- Fix JetStream wire format: Go-compatible anonymous objects with string enums,
  proper offset-based pagination for stream/consumer list APIs
- Add 42 E2E black-box tests (core messaging, auth, TLS, accounts, JetStream)
- Add ~1000 parity tests across all subsystems (gaps closure)
- Update gap inventory docs to reflect implementation status
2026-03-12 14:09:23 -04:00

51 lines
1.2 KiB
C#

using Shouldly;
using NATS.Server.WebSocket;
namespace NATS.Server.Tests.WebSocket;
public class WebSocketOptionsTests
{
[Fact]
public void DefaultOptions_PortIsNegativeOne_Disabled()
{
var opts = new WebSocketOptions();
opts.Port.ShouldBe(-1);
opts.Host.ShouldBe("0.0.0.0");
opts.Compression.ShouldBeFalse();
opts.NoTls.ShouldBeFalse();
opts.HandshakeTimeout.ShouldBe(TimeSpan.FromSeconds(2));
opts.AuthTimeout.ShouldBe(TimeSpan.FromSeconds(2));
}
[Fact]
public void NatsOptions_HasWebSocketProperty()
{
var opts = new NatsOptions();
opts.WebSocket.ShouldNotBeNull();
opts.WebSocket.Port.ShouldBe(-1);
}
[Fact]
public void WsAuthConfig_sets_auth_override_when_websocket_auth_fields_are_present()
{
var ws = new WebSocketOptions
{
Username = "u",
};
WsAuthConfig.Apply(ws);
ws.AuthOverride.ShouldBeTrue();
}
[Fact]
public void WsAuthConfig_keeps_auth_override_false_when_no_ws_auth_fields_are_present()
{
var ws = new WebSocketOptions();
WsAuthConfig.Apply(ws);
ws.AuthOverride.ShouldBeFalse();
}
}