Sezione Campus: layout dedicato, route protette e documentazione
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
// @ts-expect-error — modulo JS senza tipi, usato solo dallo script di sync
|
||||
import { parseGuide, kindOf, rewriteAssets } from '../scripts/campus/parse.mjs';
|
||||
// @ts-expect-error — idem
|
||||
import { sourceDirFor, CHAPTERS, AREAS, CH_COLORS } from '../scripts/campus/structure.mjs';
|
||||
|
||||
const body = `
|
||||
@@ -104,18 +102,19 @@ describe('rewriteAssets', () => {
|
||||
});
|
||||
|
||||
describe('struttura del corso', () => {
|
||||
const chapterNums = CHAPTERS.map((c) => c[0] as number);
|
||||
|
||||
it('ogni capitolo ha un colore e ogni area capitoli esistenti', () => {
|
||||
const nums = CHAPTERS.map((c: [number, string, string, string[]]) => c[0]);
|
||||
expect(CH_COLORS.length).toBe(CHAPTERS.length);
|
||||
for (const [, , , , chapterNums] of AREAS as [string, string, string, string, number[]][])
|
||||
for (const n of chapterNums) expect(nums).toContain(n);
|
||||
for (const area of AREAS)
|
||||
for (const n of area[4] as number[]) expect(chapterNums).toContain(n);
|
||||
});
|
||||
|
||||
it('nessuno slug duplicato e ogni capitolo è in una sola area', () => {
|
||||
const slugs = CHAPTERS.flatMap((c: [number, string, string, string[]]) => c[3]);
|
||||
const slugs = CHAPTERS.flatMap((c) => c[3] as string[]);
|
||||
expect(new Set(slugs).size).toBe(slugs.length);
|
||||
const assigned = (AREAS as [string, string, string, string, number[]][]).flatMap((a) => a[4]);
|
||||
const assigned = AREAS.flatMap((a) => a[4] as number[]);
|
||||
expect(new Set(assigned).size).toBe(assigned.length);
|
||||
expect(assigned.sort((a, b) => a - b)).toEqual(CHAPTERS.map((c: [number, string, string, string[]]) => c[0]));
|
||||
expect(assigned.sort((a, b) => a - b)).toEqual(chapterNums);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user