Added the "recorder" flag to the Analytics type in the Infrastructure package.

This commit is contained in:
2026-08-13 01:19:12 +02:00
parent 964e7fa707
commit 3bcae4d789
2 changed files with 56 additions and 2 deletions
@@ -67,6 +67,41 @@ struct AnalyticsTests {
#expect(analytics.origin == nil)
}
@Test
func `carries no recorder script URL by default`() {
let analytics = Analytics(
scriptURL: "https://analytics.example.com/script",
websiteID: "id-123",
domains: "example.com"
)
#expect(analytics.recorderScriptURL == nil)
}
@Test
func `derives its recorder script URL from the origin when recorder mode is on`() {
let analytics = Analytics(
scriptURL: "https://analytics.example.com/script",
websiteID: "id-123",
domains: "example.com",
recorder: true
)
#expect(analytics.recorderScriptURL == "https://analytics.example.com/recorder.js")
}
@Test
func `carries no recorder script URL when no origin can be derived`() {
let analytics = Analytics(
scriptURL: "/script",
websiteID: "id-123",
domains: "example.com",
recorder: true
)
#expect(analytics.recorderScriptURL == nil)
}
@Test
func `omits the disabled behavior flags`() {
let analytics = Analytics(