Added the organization identifier helper to the StructuredData type in the Infrastructure package target.

This commit is contained in:
2026-08-24 22:29:00 +02:00
parent ecafb14608
commit 0ee8368e1a
2 changed files with 28 additions and 1 deletions
@@ -46,6 +46,19 @@ struct StructuredDataTests {
))
}
@Test
func `derives the organization's identifier from the site URL`() {
let url = "https://site.example/"
let data = StructuredData(
name: "A Site",
url: url
)
// The helper is what another page references the organization by, so it has to name the node this actually builds.
#expect(StructuredData.organizationID(forSiteURL: url) == "https://site.example/#organization")
#expect(data.payload.contains(##""@id":"\##(StructuredData.organizationID(forSiteURL: url))""##))
}
@Test
func `omits the properties of the facts minimal data does not carry`() {
let data = StructuredData(