using Microsoft.Extensions.Logging.Abstractions;
using NATS.Server.Configuration;
using NATS.Server.Gateways;

namespace NATS.Server.Tests;

public class JetStreamCrossClusterGatewayParityTests
{
    [Fact]
    public async Task Cross_cluster_jetstream_messages_use_gateway_forwarding_path()
    {
        var manager = new GatewayManager(
            new GatewayOptions { Name = "GW", Host = "127.0.0.1", Port = 0 },
            new ServerStats(),
            "S1",
            _ => { },
            _ => { },
            NullLogger<GatewayManager>.Instance);

        await manager.ForwardJetStreamClusterMessageAsync(
            new GatewayMessage("$JS.CLUSTER.REPL.ORDERS", null, "x"u8.ToArray()),
            default);

        manager.ForwardedJetStreamClusterMessages.ShouldBe(1);
    }
}
