144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root.
40 lines
1.6 KiB
TypeScript
40 lines
1.6 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { render, screen, waitFor } from '@testing-library/react'
|
|
import AnatomyCanvas from '@/components/canvas/AnatomyCanvas'
|
|
|
|
vi.mock('@/anatomy/svgLoader', () => ({
|
|
loadSvg: vi.fn(async () => {
|
|
const doc = new DOMParser().parseFromString(
|
|
`<svg xmlns="http://www.w3.org/2000/svg">
|
|
<circle data-anno-id="epaule" data-anno-name-fr="Épaule" data-anno-name-en="Shoulder"
|
|
data-anno-category="articulation" class="bone osteo articulation hitbox bone-epaule" />
|
|
<circle data-anno-id="epaule" data-anno-name-fr="Épaule" data-anno-name-en="Shoulder"
|
|
data-anno-category="articulation" class="bone osteo articulation visible bone-epaule" />
|
|
</svg>`,
|
|
'image/svg+xml',
|
|
)
|
|
return doc.documentElement as unknown as SVGSVGElement
|
|
}),
|
|
}))
|
|
|
|
beforeEach(() => vi.clearAllMocks())
|
|
|
|
describe('AnatomyCanvas', () => {
|
|
it('renders the loaded SVG inline', async () => {
|
|
render(<AnatomyCanvas src="/x.svg" boneStates={new Map()} onZoneClick={() => {}} />)
|
|
await waitFor(() =>
|
|
expect(document.querySelector('[data-anno-id="epaule"]')).not.toBeNull(),
|
|
)
|
|
})
|
|
|
|
it('calls onZoneClick with the clicked bone id', async () => {
|
|
const onZoneClick = vi.fn()
|
|
render(<AnatomyCanvas src="/x.svg" boneStates={new Map()} onZoneClick={onZoneClick} />)
|
|
await waitFor(() => screen.getByTestId('anatomy-canvas'))
|
|
;(document.querySelector('[data-anno-id="epaule"]') as Element).dispatchEvent(
|
|
new Event('click', { bubbles: true }),
|
|
)
|
|
await waitFor(() => expect(onZoneClick).toHaveBeenCalledWith('epaule'))
|
|
})
|
|
})
|