using System.Collections.Generic;
using StellaOps.Feedser.Models;
using Xunit;

namespace StellaOps.Feedser.Models.Tests;

public sealed class RangePrimitivesTests
{
    [Fact]
    public void GetCoverageTag_ReturnsSpecificKinds()
    {
        var primitives = new RangePrimitives(
            new SemVerPrimitive("1.0.0", true, "1.2.0", false, null, false, null),
            new NevraPrimitive(null, null, null),
            null,
            null);

        Assert.Equal("nevra+semver", primitives.GetCoverageTag());
    }

    [Fact]
    public void GetCoverageTag_ReturnsVendorWhenOnlyExtensions()
    {
        var primitives = new RangePrimitives(
            null,
            null,
            null,
            new Dictionary<string, string> { ["vendor.status"] = "beta" });

        Assert.True(primitives.HasVendorExtensions);
        Assert.Equal("vendor", primitives.GetCoverageTag());
    }

    [Fact]
    public void GetCoverageTag_ReturnsNoneWhenEmpty()
    {
        var primitives = new RangePrimitives(null, null, null, null);
        Assert.False(primitives.HasVendorExtensions);
        Assert.Equal("none", primitives.GetCoverageTag());
    }
}
