Terminplaner: websiteUrl verweist auf die Live-Domain statt auf die Vorschau

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-03 08:17:43 +00:00
1 parent 30d40ad6ce
commit 8e25cd2d13
3 files changed
+37 -13

No files matched your search

+21 -6
View File
@@ -402,13 +402,25 @@ test('kontextPerFeature: Modus off => null ohne Anfrage; fehlendes Projekt => pr
assert.equal(await zaehleAnfragen(async () => assert.equal(await kontextPerFeature(FEATURE), null)), 0)
})
test('websiteUrl: betrieb.websiteUrl, sonst https:// + erster Host des Projekts, sonst null', () => {
assert.equal(websiteUrl(ctxMit()), 'https://salon.de/')
test('websiteUrl: betrieb.websiteUrl, sonst Live-Domain, sonst Vorschau-Subdomain, sonst Portal-Adresse', () => {
assert.equal(websiteUrl(ctxMit()), 'https://salon.de/', 'Angabe des Betriebs gewinnt auch gegen Live-Domain und Subdomain')
assert.equal(websiteUrl(ctxMit({}, { subdomain: 'salon', liveDomain: 'live.example.com' })), 'https://salon.de/')
const ohneUrl = { betrieb: betriebMit({ websiteUrl: null }) }
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon', liveDomain: 'www.salon.de' })), 'https://salon.project.webklar.com')
assert.equal(websiteUrl(ctxMit(ohneUrl, { liveDomain: 'https://www.salon.de/start' })), 'https://www.salon.de')
assert.equal(websiteUrl(ctxMit(ohneUrl, { $id: PROJEKT })), null, 'Projekt ohne Hosts')
assert.equal(websiteUrl(ctxMit(ohneUrl, null)), null, 'ohne Projekt')
// Live-Domain vor Subdomain, auch wenn die Subdomain in analyseHosts zuerst steht
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon', liveDomain: 'www.salon.de' })), 'https://www.salon.de')
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon', liveDomain: 'https://WWW.Salon.de/start?x=1' })), 'https://www.salon.de', 'Schema, Pfad und Gross-/Kleinschreibung fallen weg')
assert.equal(websiteUrl(ctxMit(ohneUrl, { liveDomain: 'salon.de' })), 'https://salon.de', 'Live-Domain ohne Subdomain')
// keine verwertbare Live-Domain => Vorschau-Subdomain
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon' })), 'https://salon.project.webklar.com')
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon', liveDomain: '' })), 'https://salon.project.webklar.com')
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon', liveDomain: 'kein host!' })), 'https://salon.project.webklar.com', 'ungueltige Live-Domain wird uebersprungen')
assert.equal(websiteUrl(ctxMit(ohneUrl, { subdomain: 'salon', liveDomain: 'salon.project.webklar.com' })), 'https://salon.project.webklar.com', 'Live-Domain gleich Subdomain-Host')
// nichts Brauchbares => Portal-Adresse
assert.equal(websiteUrl(ctxMit(ohneUrl, { $id: PROJEKT })), config.publicBaseUrl, 'Projekt ohne Hosts')
assert.equal(websiteUrl(ctxMit(ohneUrl, null)), config.publicBaseUrl, 'ohne Projekt')
assert.equal(websiteUrl({ einstellung: null, project: null }), config.publicBaseUrl)
assert.equal(websiteUrl(null), config.publicBaseUrl)
})
// ---------------------------------------------------------------- Betreffzeilen
@@ -664,6 +676,9 @@ test('Impressum und Datenschutz im Fuss: Angaben des Betriebs, sonst dessen Webs
assert.equal(web.impressum_url, 'https://salon.de/')
assert.equal(web.datenschutz_url, 'https://salon.de/')
const live = werteFuer('G03', ctxMit({ betrieb: betriebMit({ ...ohneLinks, websiteUrl: null }) }, { subdomain: 'salon', liveDomain: 'www.salon.de' }), buchung(), {}).values
assert.equal(live.impressum_url, 'https://www.salon.de', 'ohne Angabe die Live-Domain, nicht die Vorschau')
const nackt = werteFuer('G03', ctxMit({ betrieb: betriebMit({ ...ohneLinks, websiteUrl: null }) }, null), buchung(), {}).values
assert.equal(nackt.impressum_url, config.publicBaseUrl)
assert.equal(nackt.datenschutz_url, config.publicBaseUrl)