namespace NATS.Server.Tests;

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

        var snap = await fx.RequestLocalAsync("$JS.API.STREAM.SNAPSHOT.ORDERS", "{}");
        snap.Snapshot.ShouldNotBeNull();

        var restore = await fx.RequestLocalAsync("$JS.API.STREAM.RESTORE.ORDERS", snap.Snapshot!.Payload);
        restore.Success.ShouldBeTrue();
    }
}
