import { describe, expect, it } from 'vitest'; import { buildPier } from '../src/core/geometry'; import { buildRebar3D } from '../src/view/rebar3d'; import { copingBarGroup, copingFrontSvg, copingSectionSvg } from '../src/view/coping-rebar-svg'; import { loadP1 } from './helpers'; const model = buildPier(loadP1()); const scene = buildRebar3D(model); describe('코핑 배근 정면 · 단면 (승인 2026-10-26)', () => { it('the 3D bar records include the coping bars, the same data as the meshes', () => { const coping = scene.records.filter((r) => /^C\d/.test(r.name)); expect(coping.length).toBeGreaterThan(0); expect(scene.records.length).toBeGreaterThan(coping.length - 1); }); it('the front view draws one polyline per coping bar', () => { const coping = scene.records.filter((r) => /^C\d/.test(r.name)); const svg = copingFrontSvg(scene.records, model.copingL * 1000); expect((svg.match(/ { expect(copingBarGroup('C1')).toBe('main'); expect(copingBarGroup('C9')).toBe('loop'); expect(copingBarGroup('C12')).toBe('side'); expect(copingBarGroup('C15')).toBe('step'); }); it('the section at mid-length shows the bars that cross it', () => { const svg = copingSectionSvg(scene.records, model.copingL / 2); expect((svg.match(/ { it('writes each bar name once, and each spot once', () => { const svg = copingSectionSvg(scene.records, 6); const labels = (svg.match(/]*>(C\d+) s.replace(/.*>/, ''))); expect(labels).toBe(names.size); }); });