Offerings: lege description/priceNote/ctaLabel toegestaan; ASF-pakketten-seed gevuld; ASF-referentietest gerepareerd

De hosttest op GetReferencedAssemblies faalde in CI (module wordt runtime
gevonden, geen compile-referentie); Offerings-aanwezigheid via capabilities.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 09:19:23 +01:00
co-authored by Claude Sonnet 5.5
parent f2a32b26c9
commit b94245fc12
6 changed files with 58 additions and 22 deletions
+5 -1
View File
@@ -40,10 +40,14 @@ if (-not $packages -or $packages.Count -eq 0) { throw "No packages in $PackagesF
# Refuse unfinished templates: no guessed copy ends up in a CMS.
foreach ($p in $packages) {
foreach ($field in 'slug', 'title', 'description', 'price', 'priceNote', 'ctaLabel') {
foreach ($field in 'slug', 'title', 'price') {
$v = $p.$field
if ([string]::IsNullOrWhiteSpace($v) -or $v -like 'TODO*') { throw "Package '$($p.slug)': '$field' is empty or still TODO." }
}
# description, priceNote and ctaLabel may be empty (the API accepts empty strings), but never TODO.
foreach ($field in 'description', 'priceNote', 'ctaLabel') {
if ("$($p.$field)" -like 'TODO*') { throw "Package '$($p.slug)': '$field' is still TODO." }
}
if (-not $p.features -or $p.features.Count -eq 0 -or ($p.features | Where-Object { $_ -like 'TODO*' })) {
throw "Package '$($p.slug)': 'features' is empty or still TODO."
}
+24 -12
View File
@@ -2,31 +2,43 @@
{
"slug": "zwangerschap",
"title": "Zwangerschap",
"description": "TODO (uit web/src/content/packages.ts)",
"description": "",
"price": "€ 175",
"priceNote": "TODO",
"features": ["TODO", "TODO", "TODO"],
"ctaLabel": "TODO",
"priceNote": "",
"features": [
"1 uur fotografie",
"Minstens 30 zorgvuldig nabewerkte foto's",
"Persoonlijke online fotogalerij"
],
"ctaLabel": "",
"layout": "card"
},
{
"slug": "newborn",
"title": "Newborn",
"description": "TODO (uit web/src/content/packages.ts)",
"description": "",
"price": "€ 185",
"priceNote": "TODO",
"features": ["TODO", "TODO", "TODO"],
"ctaLabel": "TODO",
"priceNote": "",
"features": [
"1-2 uur fotografie",
"Minstens 40 zorgvuldig nabewerkte foto's",
"Persoonlijke online fotogalerij"
],
"ctaLabel": "",
"layout": "card"
},
{
"slug": "gezin",
"title": "Gezin",
"description": "TODO (uit web/src/content/packages.ts)",
"description": "",
"price": "€ 175",
"priceNote": "TODO",
"features": ["TODO", "TODO", "TODO"],
"ctaLabel": "TODO",
"priceNote": "",
"features": [
"1 uur fotografie",
"Minstens 30 zorgvuldig nabewerkte foto's",
"Persoonlijke online fotogalerij"
],
"ctaLabel": "",
"layout": "card"
}
]
@@ -80,12 +80,13 @@ public class HostConfigurationTests
}
[Fact]
public void Host_ReferencesOfferings_ButNotTheMasterModule()
public void Host_DoesNotReferenceTheMasterModule()
{
// Offerings has no compile-time reference from the host (modules are discovered at runtime), so its
// presence is asserted through /System/capabilities in HostPipelineTests instead.
var referenced = typeof(Program).Assembly.GetReferencedAssemblies().Select(a => a.Name);
referenced.Should().Contain("SlpModularCms.Modules.Offerings")
.And.NotContain("SlpModularCms.Modules.Master");
referenced.Should().NotContain("SlpModularCms.Modules.Master");
}
[Fact]
@@ -375,4 +375,23 @@ public class OfferingsServiceTests
ok.Should().Be(valid);
}
[Theory]
[InlineData(typeof(CreateOfferingRequest), "Description", true)]
[InlineData(typeof(CreateOfferingRequest), "PriceNote", true)]
[InlineData(typeof(CreateOfferingRequest), "CtaLabel", true)]
[InlineData(typeof(UpdateOfferingRequest), "Description", true)]
[InlineData(typeof(UpdateOfferingRequest), "PriceNote", true)]
[InlineData(typeof(UpdateOfferingRequest), "CtaLabel", true)]
[InlineData(typeof(CreateOfferingRequest), "Title", false)]
[InlineData(typeof(CreateOfferingRequest), "Price", false)]
public void Request_accepts_empty_text_only_for_description_pricenote_and_cta(Type request, string name, bool emptyAllowed)
{
var parameter = request.GetConstructors()[0].GetParameters().Single(p => p.Name == name);
var required = (System.ComponentModel.DataAnnotations.RequiredAttribute)parameter
.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.RequiredAttribute), false).Single();
required.IsValid(string.Empty).Should().Be(emptyAllowed);
required.IsValid(null).Should().BeFalse();
}
}
@@ -4,11 +4,11 @@ namespace SlpModularCms.Modules.Offerings.Models;
public record CreateOfferingRequest(
[Required, MaxLength(100)] string Title,
[Required, MaxLength(500)] string Description,
[Required(AllowEmptyStrings = true), MaxLength(500)] string Description,
[Required, MaxLength(50)] string Price,
[Required, MaxLength(100)] string PriceNote,
[Required(AllowEmptyStrings = true), MaxLength(100)] string PriceNote,
[Required, FeaturesValidation] List<string> Features,
[Required, MaxLength(50)] string CtaLabel,
[Required(AllowEmptyStrings = true), MaxLength(50)] string CtaLabel,
bool Featured = false,
[MaxLength(130)] string? Slug = null,
Guid? CategoryId = null,
@@ -4,11 +4,11 @@ namespace SlpModularCms.Modules.Offerings.Models;
public record UpdateOfferingRequest(
[Required, MaxLength(100)] string Title,
[Required, MaxLength(500)] string Description,
[Required(AllowEmptyStrings = true), MaxLength(500)] string Description,
[Required, MaxLength(50)] string Price,
[Required, MaxLength(100)] string PriceNote,
[Required(AllowEmptyStrings = true), MaxLength(100)] string PriceNote,
[Required, FeaturesValidation] List<string> Features,
[Required, MaxLength(50)] string CtaLabel,
[Required(AllowEmptyStrings = true), MaxLength(50)] string CtaLabel,
bool Featured = false,
[MaxLength(130)] string? Slug = null,
Guid? CategoryId = null,