Files
Pier_v1/tests/bearing-plan-svg.test.ts
T

33 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { buildPier } from '../src/core/geometry';
import { bearingPlanSvg } from '../src/view/bearing-plan-svg';
import { loadP1 } from './helpers';
const separate = buildPier(loadP1());
const integrated = buildPier({ ...loadP1(), bearingLayout: '일체' });
describe('교량받침 상세 평면 (승인 2026-10-26)', () => {
it('shows C4 and C5 from the bearing to the block edges along the 교축 (600 each)', () => {
const svg = bearingPlanSvg(separate, 0);
expect(svg).toContain('C4 600');
expect(svg).toContain('C5 600');
});
it('분리 draws two 1200 outlines; 일체 draws one 2500 outline (block outline only)', () => {
expect((bearingPlanSvg(separate, 0).match(/width="1200" height="1200"/g) ?? []).length).toBe(2);
expect(bearingPlanSvg(integrated, 0)).toContain('width="2500" height="1200"');
});
it('the drawing values are overlaid as dashed outlines only when given', () => {
const plain = bearingPlanSvg(separate, 0);
expect(plain).not.toContain('stroke-dasharray="40 25"');
const overlay = { front: { A: 700, B: 640 }, back: { A: 700, B: 540 } };
const svg = bearingPlanSvg(separate, 0, overlay);
expect((svg.match(/stroke-dasharray="40 25"/g) ?? []).length).toBe(2);
});
it('an unknown pair index gives an empty drawing', () => {
expect(bearingPlanSvg(separate, 99)).toBe('');
});
});