fix(transport) : intégration QUALIMAT — copie locale seulement après PATCH réussi (évite un état non persisté) (ERP-166)
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Successful in 3m4s
Pull Request — Quality gate / Frontend (lint + Vitest + build) (pull_request) Successful in 1m43s

This commit is contained in:
2026-06-17 16:01:45 +02:00
parent 40fdded7e2
commit c6259a96cd
2 changed files with 37 additions and 19 deletions
@@ -404,6 +404,23 @@ describe('useCarrierForm — copie QUALIMAT (ERP-166)', () => {
)
})
it('après création : PATCH en échec → pas de copie locale (rollback) et retour false', async () => {
mockPost.mockResolvedValueOnce({ id: 9, name: 'X', certificationType: 'GMP_PLUS' })
mockPatch.mockRejectedValueOnce({ response: { status: 500, _data: {} } })
const form = useCarrierForm()
form.main.name = 'X'
form.main.certificationType = 'GMP_PLUS'
await form.submitMain()
const ok = await form.applyQualimatSelection(QUALIMAT_ROW)
// Échec serveur : l'UI ne doit pas refléter une intégration QUALIMAT non persistée.
expect(ok).toBe(false)
expect(form.main.name).toBe('X')
expect(form.main.certificationType).toBe('GMP_PLUS')
expect(form.main.qualimatCarrierIri).toBeNull()
})
it('buildMainPayload inclut qualimatCarrier + certificationType QUALIMAT après intégration', async () => {
const form = useCarrierForm()
form.main.name = 'Acme'