Files
Pier_v1/tests/column-elevation-svg.test.ts

37 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { columnInputFor, columnRebar } from '../src/core/rebar/column';
import { columnElevationSvg } from '../src/view/column-elevation-svg';
import { loadP1 } from './helpers';
const count = (svg: string, cls: string) => svg.split(`class="${cls}"`).length - 1;
describe('기둥 정면 삽도 (승인 2026-10-26)', () => {
const m = buildPier(loadP1());
const input = columnInputFor(m);
const col = columnRebar(input);
const svg = columnElevationSvg(input, col);
it('draws one line per computed tie level (P3, P5, P4, P6)', () => {
expect(count(svg, 'p3')).toBe(col.p3.length);
expect(count(svg, 'p5')).toBe(col.p5.length);
expect(count(svg, 'p4')).toBe(col.p4.length);
expect(count(svg, 'p6')).toBe(col.p6Levels.length);
});
it('labels use the P numbers and the values that produced them', () => {
expect(svg).toContain('@300');
expect(svg).toContain('@120');
expect(svg).toContain('@3000');
expect(svg).toContain(`l_e ${col.lE} = max(${col.lEmin}, 19@120 + 60)`);
expect(svg).toContain(`기초 안 깊이 ${Math.round(input.rP4 * input.Hf)}`);
expect(svg).not.toMatch(/\bK[1-6]\b/);
});
it('draws the P1 and P2 bars on both sides (4 vertical lines)', () => {
expect(count(svg, 'p1')).toBe(2);
expect(count(svg, 'p2')).toBe(2);
expect(count(svg, 'coupler')).toBe(col.couplerP1.length * 2);
});
});