/** * Après npm run build : dist-portal + dist-/ à la racine. */ import { test, describe } from 'node:test' import assert from 'node:assert' import fs from 'node:fs' import path from 'node:path' import { fileURLToPath } from 'node:url' const __dirname = path.dirname(fileURLToPath(import.meta.url)) const repoRoot = path.resolve(__dirname, '..') const portal = path.join(repoRoot, 'dist-portal') const hasPortal = fs.existsSync(portal) describe('Artefacts build (dist-portal + dist-)', () => { test('portail + chaque deck', { skip: !hasPortal }, () => { assert.ok(fs.existsSync(path.join(portal, 'index.html'))) assert.ok(fs.existsSync(path.join(portal, 'presentations', 'index.html'))) const data = JSON.parse( fs.readFileSync(path.join(repoRoot, 'portal', '.vitepress', 'data', 'presentations.json'), 'utf8'), ) for (const p of data) { const slideRoot = path.join(repoRoot, `dist-${p.slug}`) const slideIndex = path.join(slideRoot, 'index.html') assert.ok(fs.existsSync(slideIndex), `deck manquant: dist-${p.slug}/index.html`) const presIndex = path.join(portal, 'presentations', p.slug, 'index.html') assert.ok(fs.existsSync(presIndex), `fiche manquante: dist-portal/presentations/${p.slug}/index.html`) } }) })