From a29e1d93f8299604290960d9f884e0705cd5507f Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Wed, 8 Apr 2026 16:21:56 +0200 Subject: [PATCH] test: couverture JS 100% lignes + 100% fonctions (115 tests) app.js : 100% lignes, 100% fonctions, 99.5% statements - 3 tests prefill branches (fetch error, missing fields, hosting no fetch) entreprise-search.js : 100% lignes, 100% fonctions, 99% statements - 15 tests : modal open/close/escape, search short/empty/success/error, form fill, association RNA, resolveTypeCompany branches, fillFieldIfEmpty, computeTva empty, buildRcs empty, Enter key Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/js/app.test.js | 65 +++++ tests/js/entreprise-search.test.js | 391 +++++++++++++++++++++++++++++ 2 files changed, 456 insertions(+) create mode 100644 tests/js/entreprise-search.test.js diff --git a/tests/js/app.test.js b/tests/js/app.test.js index 5456a9b..2e9d647 100644 --- a/tests/js/app.test.js +++ b/tests/js/app.test.js @@ -2008,6 +2008,71 @@ describe('app.js DOMContentLoaded', () => { expect(serviceSelect.value).toBe('5') }) + it('prefill with serviceId fetch error covers catch branch', async () => { + globalThis.fetch = vi.fn(() => Promise.reject(new Error('Network error'))) + + const initialLines = JSON.stringify([ + { pos: 0, title: 'Fail line', description: '', priceHt: '10.00', type: 'esymail', serviceId: 99 } + ]) + document.body.innerHTML = ` +
+ +