CI / frontend (push) Failing after 1m21s
CI / storybook-a11y (push) Failing after 5m27s
CI / backend (push) Successful in 1m35s
CI / codeql (csharp) (push) Failing after 1m50s
CI / codeql (javascript-typescript) (push) Failing after 1m30s
CI / api-client-drift (push) Successful in 2m1s
CI / e2e (push) Failing after 3h14m48s
Move the geldigheidsvragen wording out of DiplomaRules into Stamdata.PolicyQuestions (business-editable text, config-as-code); DiplomaRules keeps only the rule of which questions apply. Extend StamdataValidationTests (no blank id/wording, distinct ids in the manual set) and update ADR-0004. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using BigRegister.Api.Data;
|
|
using BigRegister.Domain.Diplomas;
|
|
using BigRegister.Stamdata;
|
|
|
|
namespace BigRegister.Tests;
|
|
|
|
/// <summary>
|
|
/// The compile-time gate for business-editable stamdata (ADR-0004). The C# compiler
|
|
/// already catches shape/type mistakes; these tests catch the referential integrity it
|
|
/// can't, so a bad config edit fails the build instead of reaching production.
|
|
/// </summary>
|
|
public class StamdataValidationTests
|
|
{
|
|
[Fact]
|
|
public void Every_seeded_diploma_program_maps_to_a_known_profession()
|
|
{
|
|
// The dangling-reference guard: a seed program with no entry in Professions would
|
|
// silently render "Onbekend" to the user. Fail the build instead.
|
|
foreach (var d in SeedData.Diplomas)
|
|
Assert.True(DiplomaRules.ProfessionFor(d) != "Onbekend",
|
|
$"Diploma program '{d.Opleiding}' has no profession in Stamdata.Professions.");
|
|
}
|
|
|
|
[Fact]
|
|
public void Profession_map_has_no_blank_programs_or_professions()
|
|
{
|
|
Assert.All(Professions.ByProgram, kv =>
|
|
{
|
|
Assert.False(string.IsNullOrWhiteSpace(kv.Key), "A profession-map program key is blank.");
|
|
Assert.False(string.IsNullOrWhiteSpace(kv.Value), $"Program '{kv.Key}' maps to a blank profession.");
|
|
});
|
|
}
|
|
|
|
[Fact]
|
|
public void Manual_professions_are_non_empty_and_distinct()
|
|
{
|
|
var professions = DiplomaRules.ManualProfessions();
|
|
Assert.NotEmpty(professions);
|
|
Assert.Equal(professions.Count, professions.Distinct().Count());
|
|
}
|
|
|
|
[Fact]
|
|
public void Every_policy_question_has_an_id_and_wording()
|
|
{
|
|
Assert.All(PolicyQuestions.All, q =>
|
|
{
|
|
Assert.False(string.IsNullOrWhiteSpace(q.Id), "A policy question has a blank id.");
|
|
Assert.False(string.IsNullOrWhiteSpace(q.Vraag), $"Policy question '{q.Id}' has blank wording.");
|
|
});
|
|
}
|
|
|
|
[Fact]
|
|
public void Manual_question_set_has_distinct_ids() // no field is asked twice
|
|
{
|
|
var ids = PolicyQuestions.ManualSet.Select(q => q.Id).ToList();
|
|
Assert.Equal(ids.Count, ids.Distinct().Count());
|
|
}
|
|
}
|