Initialise le front-end Vue

- Vue 3, Vite, TypeScript, Vue Router, vue-i18n, MapLibre GL JS,
  Bootstrap 5 (CSS seul), Bootstrap Icons, police Roboto.
- Pages : connexion, évaluation (adresse, carte avec couches WalOnMap,
  une carte par facteur avec badge, valeurs mesurées, onglets et
  références, état « indisponible » avec Réessayer), erreurs 403/404.
- Design repris des maquettes Penpot (charte ssmg.be), bureau et mobile.
- Garde de navigation, client API avec jeton CSRF ; l'adresse du patient
  ne quitte pas la mémoire du composant.
- 51 tests Vitest ; README et CLAUDE.md mis à jour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
boris.waaubandClaude Opus 5.5 committed 2026-11-24 11:49:23 +01:00
1 parent 7d441b11c2
commit 7f29cec2a2
52 files changed
+9347 -4

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
import { describe, expect, it, vi } from 'vitest'
import ResultMap from '@/components/ResultMap.vue'
import { mountWithPlugins } from './helpers'
// MapLibre a besoin de WebGL, absent de jsdom : on vérifie les appels.
type Fn = (...args: unknown[]) => unknown
const mapInstance = {
addControl: vi.fn<Fn>(),
resize: vi.fn<Fn>(),
jumpTo: vi.fn<Fn>(),
setLayoutProperty: vi.fn<Fn>(),
remove: vi.fn<Fn>(),
}
const marker = {
setLngLat: vi.fn<Fn>().mockReturnThis(),
addTo: vi.fn<Fn>().mockReturnThis(),
remove: vi.fn<Fn>(),
}
vi.mock('maplibre-gl', () => ({
Map: vi.fn<() => typeof mapInstance>(function () {
return mapInstance
}),
Marker: vi.fn<() => typeof marker>(function () {
return marker
}),
NavigationControl: vi.fn<Fn>(),
ScaleControl: vi.fn<Fn>(),
}))
describe('ResultMap', () => {
it("centre la carte et place le marqueur sur l'adresse", async () => {
const wrapper = mountWithPlugins(ResultMap, { props: { location: null } })
expect(marker.setLngLat).not.toHaveBeenCalled()
await wrapper.setProps({ location: { lat: 50.668, lon: 4.617, region: 'WAL' } })
expect(marker.setLngLat).toHaveBeenCalledWith([4.617, 50.668])
expect(mapInstance.jumpTo).toHaveBeenCalledWith(
expect.objectContaining({ center: [4.617, 50.668], zoom: 15 }),
)
})
it('affiche ou masque une couche WMS', async () => {
const wrapper = mountWithPlugins(ResultMap, { props: { location: null } })
await wrapper.find('#layer-noise').setValue(true)
expect(mapInstance.setLayoutProperty).toHaveBeenCalledWith('noise', 'visibility', 'visible')
await wrapper.find('#layer-flood').trigger('change')
expect(mapInstance.setLayoutProperty).toHaveBeenCalledWith('flood', 'visibility', 'none')
})
it('libère la carte au démontage', () => {
mountWithPlugins(ResultMap, { props: { location: null } }).unmount()
expect(mapInstance.remove).toHaveBeenCalled()
})
})