31 lines
1.4 KiB
TypeScript
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');
|
|
});
|
|
});
|