feat(connaissances): B19 M1 — adaptateur toMiniConnaissance (nature, échelle, porteur, couche) et nœuds du graphe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179wsewuntMrKBA2s9y7ZeX
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0118dd65f8
commit
2d3ead6f70
@@ -172,5 +172,34 @@ ok(V.valider(joint).ok, 'le jeu joint passe toujours le validateur')
|
||||
}
|
||||
ok(J.idRegistre('registre:P2-18') === 'P2-18' && J.idRegistre('cpt:x') === null, 'idRegistre : préfixe registre: seulement')
|
||||
|
||||
// ── B19 M1 : adaptateur toMiniConnaissance et graphe ────────────
|
||||
const A = await jiti.import(join(racine, 'composables', 'useFicheAdapter.ts'))
|
||||
{
|
||||
const fiches = A.fichesConnaissances(fixture)
|
||||
const ids = fiches.map((f) => f.id)
|
||||
ok(fiches.length === fixture.objets.filter((o) => o.etat === 'publie').length, `adaptateur : une fiche par objet publié (${fiches.length})`)
|
||||
ok(!ids.includes('cpt:signaux-faibles-ansoff') && !ids.includes('txt:noubel-economie-du-don'), 'adaptateur : a_trier et a_creuser ne sont pas rendus')
|
||||
{
|
||||
const j = copie(fixture)
|
||||
objet(j, 'cpt:matrice-aep').etat = 'ecarte'
|
||||
ok(!A.fichesConnaissances(j).some((f) => f.id === 'cpt:matrice-aep'), 'adaptateur : un objet écarté n’est pas rendu')
|
||||
}
|
||||
const h = fiches.find((f) => f.id === 'cpt:holoptisme')
|
||||
ok(h.kind === 'concept' && h.nom === 'Holoptisme' && h.resume === objet(fixture, 'cpt:holoptisme').definition_courte, 'adaptateur : id préfixé, kind = nature, nom canonique, résumé = définition')
|
||||
ok(JSON.stringify(h.etiquettes) === JSON.stringify({ nature: ['concept'], echelle: ['S', 'M'], porteur: ['holosapiens'], couche: ['socle'] }), 'adaptateur : étiquettes nature, échelle, porteur, couche', JSON.stringify(h.etiquettes))
|
||||
ok(h.date === '2015-08-08' && h.geoloc === true, 'adaptateur : date = date_original ; pas de géographie')
|
||||
const t = fiches.find((f) => f.id === 'txt:hs-signaux-faibles')
|
||||
ok(t.kind === 'texte' && t.resume.includes('Les signaux faibles') && t.resume.includes('Holosapiens'), 'adaptateur : résumé d’un objet = titre et porteur', t.resume)
|
||||
ok(JSON.stringify(t.etiquettes.echelle) === JSON.stringify(['XL']), 'adaptateur : échelles d’une source = celles de ses concepts (projection)', JSON.stringify(t.etiquettes.echelle))
|
||||
ok(fiches.find((f) => f.id === 'org:holosapiens').etiquettes.porteur[0] === 'holosapiens', 'adaptateur : une organisation se porte elle-même')
|
||||
|
||||
const g = A.grapheConnaissances(fixture)
|
||||
ok(g.noeuds.length === fiches.length, 'graphe : un nœud par fiche')
|
||||
ok(g.liens.every((l) => ids.includes(l.de) && ids.includes(l.vers)), 'graphe : aucun lien vers un objet non rendu')
|
||||
ok(!g.liens.some((l) => l.type === 'renvoie_a' || l.type === 'homonyme_de'), 'graphe : ni renvoie_a ni homonyme vers un non-publié')
|
||||
ok(g.noeuds.every((x) => !('x' in x) && !('y' in x)), 'graphe : aucune position dans les données')
|
||||
ok(g.liens.some((l) => l.type === 'recoupe' && l.de === 'cpt:architectures-invisibles' && l.vers === 'cpt:matrice-aep'), 'graphe : le croisement architectures invisibles ↔ matrice est un lien')
|
||||
}
|
||||
|
||||
console.log(`\n${n - echecs}/${n} OK${echecs ? ` · ${echecs} ÉCHEC(S)` : ''}`)
|
||||
process.exit(echecs ? 1 : 0)
|
||||
|
||||
Reference in New Issue
Block a user