fix(aep-15): description, nom et ville du modèle bornés avant la colonne
Checkpoint 22/11, correction 4. Ces trois textes n'étaient bornés que par leur type. lib/extraction.js::texteBorne les coupe à 300, 200 et 100 caractères (en points de code), une chaîne vide vaut null. Antérieur au lot, mais le lot touche ces lignes. Tests : texteBorne seul, et un PATCH à blanc où le modèle rend 1 200 / 450 / 400 caractères. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { readFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { TYPES_ORGANISATION, POSTURES, LIBELLES_TYPE, LIBELLES_POSTURE, proposerType, proposerPostures } from '../lib/taxonomie.js';
|
||||
import { extractionDepuisModele } from '../lib/extraction.js';
|
||||
import { extractionDepuisModele, texteBorne, MAX_COLONNES } from '../lib/extraction.js';
|
||||
|
||||
const ici = dirname(fileURLToPath(import.meta.url));
|
||||
const SITE = readFileSync(join(ici, '..', '..', 'utils', 'taxonomie.ts'), 'utf-8');
|
||||
@@ -98,3 +98,13 @@ describe('lot 15 · extraction rendue par le modèle, bornée', () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkpoint 22/11 · textes du modèle écrits en colonne, bornés (correction 4)', () => {
|
||||
it('300, 200 et 100 caractères ; coupe en points de code ; vide et non-texte → null', () => {
|
||||
assert.deepEqual(MAX_COLONNES, { description_enrichie: 300, nom: 200, localisation_ville: 100 });
|
||||
assert.equal(texteBorne('a'.repeat(500), 300).length, 300);
|
||||
assert.equal(texteBorne(' Lyon ', 100), 'Lyon');
|
||||
assert.equal(texteBorne('é'.repeat(99) + '😀😀', 100), 'é'.repeat(99) + '😀', 'jamais la moitié d’un émoji');
|
||||
for (const v of [null, undefined, 42, {}, ['x'], '', ' ']) assert.equal(texteBorne(v, 100), null);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user