Files
Pier_v1/tests/footing-svg.test.ts
ypshimandClaude Haiku 5.5 675f8124ca feat(view): 확대기초·말뚝 plan and side drawings on ② (2단계), drawn from the model
The footing card shows a plan (footing rectangle, pile circles, column, pier axis, mm labels) and an elevation (footing,
piles to their tips, column, h1 and pile length). The drawings are SVG strings built from the model, so they follow the
inputs. θ is noted as not yet applied. Tests check the pile count, the mm labels and the width input.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-23 16:02:37 +09:00

31 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { footingPlanSvg, footingSideSvg } from '../src/view/footing-svg';
import { loadP1 } from './helpers';
const m = buildPier(loadP1());
const count = (svg: string, tag: string) => (svg.match(new RegExp(`<${tag} `, 'g')) ?? []).length;
describe('확대기초·말뚝 그림 (2단계, 승인 2026-10-23)', () => {
it('the plan draws one circle per pile under the footing, and labels the footing length and width in mm', () => {
const svg = footingPlanSvg(m);
const piles = m.piles.filter((p) => Math.abs(p.s - m.footings[0].s) <= m.footings[0].length / 2 + 1e-6).length;
// The column circles are dashed; the pile circles are the solid ones.
expect(count(svg, 'circle') - m.columns.length).toBe(piles);
expect(svg).toContain('10400');
expect(svg).toContain('8150');
});
it('the side view shows the footing rectangle and one line per pile, with the pile length label', () => {
const svg = footingSideSvg(m);
expect(count(svg, 'line')).toBeGreaterThanOrEqual(20);
expect(svg).toContain('h1 2000');
expect(svg).toContain('말뚝 24000');
});
it('the drawings follow the footing inputs (width 9000 mm shows in the plan label)', () => {
const wide = buildPier({ ...loadP1(), footingWidthMm: 9000 });
expect(footingPlanSvg(wide)).toContain('9000');
});
});