namespace NATS.Server.Tests;

public class JetStreamConsumerSemanticsTests
{
    [Fact]
    public async Task Consumer_with_filter_subjects_only_receives_matching_messages()
    {
        await using var fx = await JetStreamApiFixture.StartWithMultiFilterConsumerAsync();
        await fx.PublishAndGetAckAsync("orders.created", "1");
        await fx.PublishAndGetAckAsync("payments.settled", "2");

        var batch = await fx.FetchAsync("ORDERS", "CF", 10);
        batch.Messages.ShouldNotBeEmpty();
        batch.Messages.All(m => m.Subject.StartsWith("orders.", StringComparison.Ordinal)).ShouldBeTrue();
    }
}
