Added the organization descriptors and a number value to the structured data types in the Infrastructure package.

This commit is contained in:
2026-08-23 10:13:37 +02:00
parent 6c014525bf
commit fcfb3f21d5
4 changed files with 47 additions and 1 deletions
@@ -30,6 +30,21 @@ struct StructuredDataTests {
)
}
@Test
func `carries the organization's alternate name, description, and area in that order`() {
let data = StructuredData(
name: "A Site",
url: "https://site.example/",
alternateName: "The Site",
description: "What the site is.",
areaServed: "A City"
)
#expect(data.payload.contains(
#""name":"A Site","url":"https://site.example/","alternateName":"The Site","description":"What the site is.","areaServed":"A City""#
))
}
@Test
func `omits the properties of the facts minimal data does not carry`() {
let data = StructuredData(
@@ -120,6 +135,9 @@ struct StructuredDataTests {
#expect(StructuredData.Value.array([.string("A"), .string("B")]).fragment == #"["A","B"]"#)
#expect(StructuredData.Value.reference("https://site.example/#organization").fragment == #"{"@id":"https://site.example/#organization"}"#)
#expect(StructuredData.Value.node(.init(type: "Place", properties: [])).fragment == #"{"@type":"Place"}"#)
// Unquoted, or a consumer reads the position of a list item as text and cannot order by it.
#expect(StructuredData.Value.number(1).fragment == "1")
#expect(StructuredData.Value.number(-3).fragment == "-3")
}
@Test