From adb2b930dd42ae8cf8d2e255f20669bb0002c6d4 Mon Sep 17 00:00:00 2001 From: IliesAllali Date: Sun, 18 Oct 2026 19:51:19 +0200 Subject: [PATCH] =?UTF-8?q?fix(surnoms):=20garder=20le=20surnom=20d'un=20a?= =?UTF-8?q?rbre=20charg=C3=A9=20depuis=20l'API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le surnom était enregistré en base mais perdu au chargement de l'arbre : mapRemotePersonToLocal ne le recopiait pas, donc ni l'arbre, ni la fiche, ni la recherche ne le voyaient. Co-Authored-By: Claude Opus 5.5 --- frontend/src/data/mockData.js | 1 + frontend/src/data/mockData.test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/frontend/src/data/mockData.js b/frontend/src/data/mockData.js index c0b6890..6e04583 100644 --- a/frontend/src/data/mockData.js +++ b/frontend/src/data/mockData.js @@ -103,6 +103,7 @@ function mapRemotePersonToLocal(person, current = null) { firstName: person?.firstName || current?.firstName || t('Inconnu'), lastName: person?.lastName || current?.lastName || '', birthName: person?.birthName ?? current?.birthName ?? null, + nickname: person?.nickname ?? null, birthYear, birthDate: person?.birthDate || current?.birthDate || null, deathDate: person?.deathDate || current?.deathDate || null, diff --git a/frontend/src/data/mockData.test.js b/frontend/src/data/mockData.test.js index ee6caf9..a109f9e 100644 --- a/frontend/src/data/mockData.test.js +++ b/frontend/src/data/mockData.test.js @@ -76,3 +76,17 @@ describe('loadGraphData, union à un seul parent', () => { expect(getChildren('julien').map((p) => p.id).sort()).toEqual(['hugo', 'lea']) }) }) + +describe('loadGraphData, surnom', () => { + it("garde le surnom renvoyé par l'API", () => { + loadGraphData({ + persons: [ + { id: 'p-1', firstName: 'Louise', lastName: 'Martin', birthDate: null, deathDate: null, notes: null, nickname: 'Loulou' }, + { id: 'p-2', firstName: 'Paul', lastName: 'Martin', birthDate: null, deathDate: null, notes: null, nickname: null }, + ], + unions: [], filiations: [], medias: [], annotations: [], + }) + expect(getPersonById('p-1').nickname).toBe('Loulou') + expect(getPersonById('p-2').nickname).toBeNull() + }) +})