Files
Pier_v1/tests/column-section-svg.test.ts
T

35 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { columnInputFor, columnRebar } from '../src/core/rebar/column';
import { columnSectionSvg } from '../src/view/column-section-svg';
import { loadP1 } from './helpers';
const count = (svg: string, cls: string) => svg.split(`class="${cls}"`).length - 1;
describe('기둥 단면 A·B·C (승인 2026-10-26, 추천)', () => {
const m = buildPier(loadP1());
const input = columnInputFor(m);
const col = columnRebar(input);
it('A 일반: no coupler, P1 and P2 at all 46 angles, no P6 chords', () => {
const svg = columnSectionSvg('A', input, col);
expect(count(svg, 'coupler')).toBe(0);
expect(count(svg, 'p1')).toBe(input.nDiv);
expect(count(svg, 'p2')).toBe(input.nDiv);
expect(count(svg, 'p6')).toBe(0);
});
it('C 단부 (P5): one coupler on a full ring', () => {
const svg = columnSectionSvg('C', input, col);
expect(count(svg, 'coupler')).toBe(1);
expect(count(svg, 'p5')).toBe(1);
});
it('B 확대기초 안 (P4): two semicircles, two couplers, and the four P6 chords at its P6 level', () => {
const svg = columnSectionSvg('B', input, col);
expect(count(svg, 'coupler')).toBe(2);
expect(count(svg, 'p4')).toBe(2);
expect(count(svg, 'p6')).toBe(4);
});
});