import { describe, expect, it } from 'vitest'; import { buildPier } from '../src/core/geometry'; import { bearingSectionSvg } from '../src/view/bearing-section-svg'; import { solplateDetailSvg } from '../src/view/solplate-svg'; import { loadP1 } from './helpers'; const model = buildPier(loadP1()); const integrated = buildPier({ ...loadP1(), bearingLayout: '일체' }); const ref = { h1: 150, h2: 50, h3: 181, h4: 30, E: 425, A: 700, B: 640 }; describe('교량받침 상세 단면 (승인 2026-10-26)', () => { it('labels EL.X at the mortar top and the block height h1 for each bearing', () => { const svg = bearingSectionSvg(model, 0); expect(svg).toContain('EL.X'); expect(svg).toContain('h1 150'); }); it('draws the drawing heights dashed only when given', () => { expect(bearingSectionSvg(model, 0)).not.toContain('stroke-dasharray="40 25"'); const svg = bearingSectionSvg(model, 0, { front: ref, back: ref }); expect((svg.match(/stroke-dasharray="40 25"/g) ?? []).length).toBeGreaterThan(0); }); it('일체 draws one stepped outline (a polygon) for the pair', () => { expect(bearingSectionSvg(integrated, 0)).toContain(' { expect(bearingSectionSvg(model, 99)).toBe(''); }); }); describe('솔플레이트 상세 (승인 2026-10-26)', () => { it('shows L, W, T1 and T2 of the model plan, with the drawing dashed when given', () => { const withPlan = buildPier({ ...loadP1(), bearingPlans: [{ no: 1, A: 700, B: 640, S: -1.9 }] }); const block = withPlan.blocks.find((b) => b.no === 1)!; const svg = solplateDetailSvg(block); expect(svg).toContain('L '); expect(svg).toContain('T1 '); expect(svg).toContain('T2 '); const withRef = solplateDetailSvg(block, { L: 800, W: 748, T1: 38, T2: 22, S: 1.9 }); expect(withRef).toContain('stroke-dasharray="40 25"'); }); });