Initial commit (history squashed)

This commit is contained in:
master
2025-10-07 10:14:21 +03:00
commit 016c5a3fe7
1132 changed files with 117842 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using System;
using System.Linq;
using StellaOps.Feedser.Source.Vndr.Chromium;
using StellaOps.Feedser.Source.Vndr.Chromium.Internal;
using Xunit;
namespace StellaOps.Feedser.Source.Vndr.Chromium.Tests;
public sealed class ChromiumMapperTests
{
[Fact]
public void Map_DeduplicatesReferencesAndOrdersDeterministically()
{
var published = new DateTimeOffset(2024, 9, 12, 14, 0, 0, TimeSpan.Zero);
var metadata = new ChromiumDocumentMetadata(
"post-123",
"Stable Channel Update",
new Uri("https://chromium.example/stable-update.html"),
published,
null,
"Security fixes");
var dto = ChromiumDto.From(
metadata,
new[] { "CVE-2024-0001" },
new[] { "windows" },
new[] { new ChromiumVersionInfo("windows", "stable", "128.0.6613.88") },
new[]
{
new ChromiumReference("https://chromium.example/ref1", "advisory", "Ref 1"),
new ChromiumReference("https://chromium.example/ref1", "advisory", "Ref 1 duplicate"),
new ChromiumReference("https://chromium.example/ref2", "patch", "Ref 2"),
});
var (advisory, _) = ChromiumMapper.Map(dto, VndrChromiumConnectorPlugin.SourceName, published);
var referenceUrls = advisory.References.Select(r => r.Url).ToArray();
Assert.Equal(
new[]
{
"https://chromium.example/ref1",
"https://chromium.example/ref2",
"https://chromium.example/stable-update.html",
},
referenceUrls);
}
}