fix(seo): B23 — fiches du sitemap en fonction pure testée (jamais le repli seed, Id nul ignoré) — checkpoint AEP 22/10

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AB8CwgrRNDCUvEnhvL5wRP
This commit is contained in:
Jules Neny
2026-10-22 23:44:23 +02:00
co-authored by Claude Fable 5.1
parent f9ce7a495a
commit 902517bd3c
3 changed files with 28 additions and 10 deletions
+8 -1
View File
@@ -13,7 +13,7 @@ import { dirname, join } from 'node:path'
const __dirname = dirname(fileURLToPath(import.meta.url))
const jiti = createJiti(import.meta.url)
const { canonique, robots, redirection, robotsTxt, cheminsSitemap, sitemapXml, dateSitemap } = await jiti.import(
const { canonique, robots, redirection, robotsTxt, cheminsSitemap, sitemapXml, dateSitemap, entreesFichesSitemap } = await jiti.import(
join(__dirname, '..', 'utils', 'seo.ts'),
)
@@ -90,6 +90,13 @@ egal('sitemap XML échappé', xml.includes('fiche/1?a=1&amp;b=2'), true)
egal('sitemap XML en-tête', xml.startsWith('<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'), true)
egal('dateSitemap', [dateSitemap('2026-10-13 08:12:00+00:00'), dateSitemap(''), dateSitemap('n/a')], ['2026-10-13', undefined, undefined])
// Fiches du sitemap : jamais le repli seed, au moins une /fiche/ quand NocoDB répond, Id nul ignoré (checkpoint 22/10)
const fiches = [{ Id: 108, UpdatedAt: '2026-10-01 10:00:00+00:00' }, { Id: null }, { Id: 7 }]
egal('fiches sitemap : repli seed → aucune', entreesFichesSitemap({ source: 'seed', list: fiches }), [])
egal('fiches sitemap : nocodb → les fiches avec Id', entreesFichesSitemap({ source: 'nocodb', list: fiches }, A),
[{ loc: `${A}/fiche/108`, lastmod: '2026-10-01' }, { loc: `${A}/fiche/7`, lastmod: undefined }])
egal('fiches sitemap : réponse absente → aucune', [entreesFichesSitemap(null), entreesFichesSitemap({ source: 'nocodb' })], [[], []])
// ── HTTP (optionnel, serveur lancé) ─────────────────────────────
const base = process.argv[2]
if (base) {