Mode plat : seulement quand l'arc et le chapitre uniques sont vides
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 38s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 1m4s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Failing after 1m52s
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 38s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 1m4s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Failing after 1m52s
Une méthode guidée lancée dans une campagne vide crée un arc et un chapitre qui portent le contenu écrit (titre, accroche, enjeux, vérité cachée ou plan du méchant en notes MJ). Le mode plat les masquait : ce contenu devenait introuvable derrière le nœud « Scènes ». - Règle commune (flat-structure.ts) : un seul arc linéaire, un seul chapitre, et aucun contenu d'écriture dans l'un ou l'autre (les noms ne comptent pas, « Arc principal » / « Chapitre 1 » étant créés d'office). - Appliquée au volet de gauche, à la page de la campagne (cartes d'arc visibles dès qu'il y a du contenu) et au livret PDF (en-têtes d'arc et de chapitre conservés ; un arc HUB n'est plus jamais mis à plat). Vérifié : core clean verify (1289 tests, dont livret plat / non plat), web build + 860 vitest (règle du mode plat), lint sans erreur. À redéployer : core + web (aucune migration).
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { flatContainer } from './flat-structure';
|
||||
import { Arc, Chapter } from '../services/campaign.model';
|
||||
|
||||
describe('flatContainer (mode plat)', () => {
|
||||
const arc = (extra: Partial<Arc> = {}): Arc => ({ id: 'a1', name: 'Arc principal', campaignId: 'c', type: 'LINEAR', ...extra } as Arc);
|
||||
const chapter = (extra: Partial<Chapter> = {}): Chapter => ({ id: 'ch1', name: 'Chapitre 1', arcId: 'a1', ...extra } as Chapter);
|
||||
|
||||
it('flattens a single empty arc with a single empty chapter', () => {
|
||||
expect(flatContainer([arc()], { a1: [chapter()] })?.chapter.id).toBe('ch1');
|
||||
});
|
||||
|
||||
it('keeps the structure once the chapter or the arc has written content', () => {
|
||||
expect(flatContainer([arc()], { a1: [chapter({ gmNotes: 'Le notaire est coupable' })] })).toBeNull();
|
||||
expect(flatContainer([arc()], { a1: [chapter({ description: "L'affaire commence" })] })).toBeNull();
|
||||
expect(flatContainer([arc({ hooks: '- Un ami disparaît' })], { a1: [chapter()] })).toBeNull();
|
||||
expect(flatContainer([arc({ illustrationImageIds: ['img'] })], { a1: [chapter()] })).toBeNull();
|
||||
});
|
||||
|
||||
it('ignores names and blank text', () => {
|
||||
expect(flatContainer([arc({ name: 'Ma campagne', stakes: ' ' })], { a1: [chapter({ name: 'Début' })] })).not.toBeNull();
|
||||
});
|
||||
|
||||
it('never flattens a HUB arc, several chapters or several arcs (system arc ignored)', () => {
|
||||
expect(flatContainer([arc({ type: 'HUB' })], { a1: [chapter()] })).toBeNull();
|
||||
expect(flatContainer([arc()], { a1: [chapter(), chapter({ id: 'ch2' })] })).toBeNull();
|
||||
expect(flatContainer([arc(), arc({ id: 'a2' })], { a1: [chapter()], a2: [] })).toBeNull();
|
||||
expect(flatContainer([arc(), arc({ id: 'sys', type: 'SYSTEM' })], { a1: [chapter()] })).not.toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user