Files
Pier_v1/tests/parse.test.ts
T
ypshimandClaude Haiku 5.5 d963d8ed3c feat(core): parse P1 workbook and build T-type pier shape
- parse Excel input by header strings (pier, IP, bearing tables)
- DMS azimuth parser (E03), input validation (E01, E02)
- pure geometry: axis, bearings, stepped coping, column, footing, piles, blinding
- warnings W01, W02, W05, W07, I01
- regression tests against spec.md section 12 (P1)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-21 17:26:16 +09:00

35 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { parseWorkbook } from '../src/core/parseWorkbook';
import { loadP1, loadWorkbook } from './helpers';
describe('parseWorkbook (P1 sheet intent.PR)', () => {
it('finds exactly one pier P1 with the input values of the sheet', () => {
const { piers, issues } = parseWorkbook(loadWorkbook());
expect(issues).toEqual([]);
expect(piers.map((p) => p.name)).toEqual(['P1']);
const p1 = loadP1();
expect(p1.type).toBe('T형');
expect(p1.foundationType).toBe('말뚝기초');
expect(p1.copingTopEl).toBeCloseTo(43.411, 6);
expect(p1.footingBottomEl).toBeCloseTo(26.208, 6);
expect(p1.groundEl).toBeCloseTo(28.931, 6);
expect(p1.pileLengthMm).toBe(24000);
expect(p1.copingWidthMm).toBe(3100);
expect(p1.copingLengthMm).toBe(12000);
expect(p1.columnCount).toBe(1);
});
it('reads 4 IP points and 10 bearings (5 front, 5 back)', () => {
const p1 = loadP1();
expect(p1.ips.map((p) => p.name)).toEqual(['IP1', 'IP2', 'IP3', 'IP4']);
expect(p1.bearings).toHaveLength(10);
expect(p1.bearings.filter((b) => b.row === '전열')).toHaveLength(5);
expect(p1.bearings.filter((b) => b.row === '후열')).toHaveLength(5);
});
it('converts the bearing azimuth strings to decimal degrees', () => {
const p1 = loadP1();
expect(p1.bearings[0].azimuthDeg).toBeCloseTo(75.9489, 4);
});
});