more audit work
This commit is contained in:
@@ -14,6 +14,13 @@ namespace StellaOps.Policy.Pack.Tests;
|
||||
|
||||
public class PolicyPackSchemaTests
|
||||
{
|
||||
private static readonly Lazy<JsonSchema> Schema = new(() =>
|
||||
{
|
||||
var schemaPath = Path.Combine(AppContext.BaseDirectory, "TestData", "policy-pack.schema.json");
|
||||
var schemaContent = File.ReadAllText(schemaPath);
|
||||
return JsonSchema.FromText(schemaContent);
|
||||
});
|
||||
|
||||
private readonly string _testDataPath;
|
||||
private readonly JsonSchema _schema;
|
||||
private readonly IDeserializer _yamlDeserializer;
|
||||
@@ -22,9 +29,7 @@ public class PolicyPackSchemaTests
|
||||
public PolicyPackSchemaTests()
|
||||
{
|
||||
_testDataPath = Path.Combine(AppContext.BaseDirectory, "TestData");
|
||||
var schemaPath = Path.Combine(_testDataPath, "policy-pack.schema.json");
|
||||
var schemaContent = File.ReadAllText(schemaPath);
|
||||
_schema = JsonSchema.FromText(schemaContent);
|
||||
_schema = Schema.Value;
|
||||
|
||||
_yamlDeserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||
|
||||
@@ -8,3 +8,5 @@ Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.
|
||||
| AUDIT-0447-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Policy.Pack.Tests. |
|
||||
| AUDIT-0447-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Policy.Pack.Tests. |
|
||||
| AUDIT-0447-A | DONE | Waived (test project; revalidated 2026-01-07). |
|
||||
| AUDIT-0563-T | DONE | Revalidated 2026-01-08 (starter policy pack schema + overrides). |
|
||||
| AUDIT-0563-A | DONE | Revalidated 2026-01-08 (starter policy pack schema + overrides). |
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using System.Linq;
|
||||
using StellaOps.Policy.RiskProfile.Validation;
|
||||
using Xunit;
|
||||
|
||||
@@ -56,7 +57,8 @@ public class RiskProfileValidatorTests
|
||||
var result = _validator.Validate(invalidProfile);
|
||||
|
||||
Assert.False(result.IsValid);
|
||||
Assert.NotEmpty(result.Errors!);
|
||||
var hasErrors = result.Errors is { Count: > 0 } || (result.Details?.Any(detail => !detail.IsValid) ?? false);
|
||||
Assert.True(hasErrors, "Expected schema validation errors");
|
||||
}
|
||||
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
|
||||
@@ -8,3 +8,5 @@ Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.
|
||||
| AUDIT-0452-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Policy.RiskProfile.Tests. |
|
||||
| AUDIT-0452-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Policy.RiskProfile.Tests. |
|
||||
| AUDIT-0452-A | DONE | Waived (test project; revalidated 2026-01-07). |
|
||||
| AUDIT-0565-T | DONE | Revalidated 2026-01-08 (risk profile schema caching + errors). |
|
||||
| AUDIT-0565-A | DONE | Revalidated 2026-01-08 (risk profile schema caching + errors). |
|
||||
|
||||
Reference in New Issue
Block a user