Files
Pier_v1/tests/bearing-basis.test.ts
T
CopilotandCopilot 06e1b97a62
ITAM Code Check / build-and-config-check (push) Failing after 37s
ITAM Docker Build Check / docker-build-check (push) Failing after 1m0s
교각 프로그램 초기 버전
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 15:55:01 +09:00

36 lines
1.8 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { BEARING_ELEVATION_REF, DRAWING_TOL_MM, drawingCopingCheck, withDrawingBasis, type DrawingBearing } from '../src/core/bearing-ref';
import { loadP1 } from './helpers';
const drawing: DrawingBearing[] = BEARING_ELEVATION_REF.map((r) => ({ no: r.no, elx: r.elx, h1: r.h1, h2: r.h2 }));
describe('받침 기준: 도면 EL.X (Q16 option 2, 승인 2026-10-23)', () => {
it('the default basis (엑셀 z) keeps the model as before: the drawing check still reports the EL.X gap', () => {
const excel = buildPier(loadP1());
expect(excel.blocks.filter((b) => b.row === '전열')[0].padTop).toBeCloseTo(43.561, 3);
});
it('with the drawing basis the pads sit at the drawing EL.X and the coping tops stay within the 5 mm tolerance', () => {
const m = buildPier(withDrawingBasis(loadP1(), drawing));
expect(m.blocks.filter((b) => b.row === '전열')[0].padTop).toBeCloseTo(43.625, 3);
for (const c of drawingCopingCheck(m, drawing)) {
expect(Math.abs(c.diffMm), `No ${c.no}`).toBeLessThanOrEqual(DRAWING_TOL_MM);
}
});
it('with the drawing basis the front block (h1) is 164 mm and the back block 139 mm, excluding the 50 mm pad', () => {
const m = buildPier(withDrawingBasis(loadP1(), drawing));
const front = m.blocks.filter((b) => b.row === '전열')[0];
const back = m.blocks.filter((b) => b.row === '후열')[0];
expect(Math.round((front.top - front.bottom) * 1000)).toBe(164);
expect(Math.round((back.top - back.bottom) * 1000)).toBe(139);
});
it('a drawing row that is off by more than 5 mm is flagged', () => {
const bad = drawing.map((d) => (d.no === 3 ? { ...d, elx: d.elx + 0.02 } : d));
const c = drawingCopingCheck(buildPier(loadP1()), bad).find((x) => x.no === 3)!;
expect(c.ok).toBe(false);
});
});