using NATS.Server.TestUtilities;

namespace NATS.Server.JetStream.Tests;

public class JetStreamDirectGetApiTests
{
    [Fact]
    public async Task Direct_get_returns_message_without_stream_info_wrapper()
    {
        await using var fx = await JetStreamApiFixture.StartWithStreamAsync("ORDERS", "orders.*");
        var ack = await fx.PublishAndGetAckAsync("orders.created", "1");

        var direct = await fx.RequestLocalAsync("$JS.API.DIRECT.GET.ORDERS", $"{{\"seq\":{ack.Seq}}}");
        direct.DirectMessage.ShouldNotBeNull();
        direct.DirectMessage!.Payload.ShouldBe("1");
    }
}
