Files
Pier_v1/tests/column-diameter.test.ts

33 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { columnDiameterIssues } from '../src/core/column-check';
import { columnInputFor, columnRebar } from '../src/core/rebar/column';
import { loadP1 } from './helpers';
describe('기둥 직경 D 입력 (승인 2026-10-23)', () => {
it('the default (absent) is 2000 mm and gives the P1 results', () => {
const m = buildPier(loadP1());
expect(m.columnDiameterMm).toBe(2000);
expect(columnInputFor(m).D).toBe(2000);
expect(columnRebar(columnInputFor(m)).mainP1).toBe(230);
});
it('a larger D (2500) changes the column radius and the rebar, and the model follows the input', () => {
const m = buildPier({ ...loadP1(), columnDiameterMm: 2500 });
expect(m.columnDiameterMm).toBe(2500);
expect(m.columns[0].diameter).toBeCloseTo(2.5, 6);
const col = columnRebar(columnInputFor(m));
expect(col.r1).toBeCloseTo(2500 / 2 - 125 - 0, 0); // r1 = D/2 − c, the outer bar radius
});
it('the checks: range and 50 mm steps, D below the Level width, D + 2c within the coping width, arc spacing', () => {
const m = buildPier(loadP1());
expect(columnDiameterIssues(2000, m)).toEqual([]);
expect(columnDiameterIssues(2050, m)).toEqual([]);
expect(columnDiameterIssues(3200, m).length).toBe(1);
expect(columnDiameterIssues(2025, m).length).toBe(1);
expect(columnDiameterIssues(2100, m).some((x) => x.includes('Level 폭'))).toBe(true);
expect(columnDiameterIssues(2050, m).some((x) => x.includes('코핑 폭'))).toBe(false);
});
});