From b2b3a1d218004884fdf82b4468efa58b88046418 Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Wed, 4 Nov 2026 23:28:49 +0100 Subject: [PATCH] test: Journal-shaped records in the hreflang test TestHreflangAlternates uses a record shaped as the Journal descriptors describe one: every enabled locale in sort order, the untranslated one with URL "" and the default locale's title, description and word count; the files still carry no hreflang for that locale. --- sitemap_index_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sitemap_index_test.go b/sitemap_index_test.go index 9993325..8214c04 100644 --- a/sitemap_index_test.go +++ b/sitemap_index_test.go @@ -644,8 +644,14 @@ func TestHreflangAlternates(t *testing.T) { t.Fatal(err) } mod := time.Date(2026, 10, 1, 8, 0, 0, 0, time.UTC) + // G3: a Journal-shaped record (P33-64): every enabled locale in sort + // order, the untranslated de with URL "" and the default locale's + // title, description and word count. + words := 120 contentStore.put(pageType, fakeRecord{ID: 1, Published: true, LastMod: mod, Locales: []pact.ContentLocale{ - {Locale: "en", URL: "/en/pages/a"}, {Locale: "pl", URL: "/strony/a"}, {Locale: "de", URL: ""}, + {Locale: "pl", URL: "/strony/a", Title: "Strona A", Description: "O stronie", Words: &words}, + {Locale: "en", URL: "/en/pages/a", Title: "Page A", Description: "About the page", Words: &words}, + {Locale: "de", URL: "", Title: "Strona A", Description: "O stronie", Words: &words}, }}) contentStore.put(pageType, fakeRecord{ID: 2, Published: true, LastMod: mod, Locales: []pact.ContentLocale{{Locale: "pl", URL: "/strony/b"}}}) e.rebuild(t) @@ -653,8 +659,8 @@ func TestHreflangAlternates(t *testing.T) { if !strings.Contains(body, ``) { t.Fatalf("the xhtml namespace is not declared:\n%s", body) } - alts := `` + - `` + + alts := `` + + `` + `` for _, loc := range []string{"https://api.example.test/en/pages/a", "https://api.example.test/strony/a"} { if !strings.Contains(body, ""+loc+"2026-10-01T08:00:00Z"+alts+"") {