import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import * as XLSX from 'xlsx'; import { describe, expect, it } from 'vitest'; import { ABUT_DETAIL_LABELS, abutInputRows, abutSummaryRows } from '../src/core/abut/summary'; import { parseAbutments } from '../src/core/abut/parse'; const RAG = fileURLToPath(new URL('../../../RAG/운곡교P1입력.xlsx', import.meta.url)); const rec = parseAbutments(XLSX.read(readFileSync(RAG), { type: 'buffer' })).abutments[0]; describe('교대 패널 행 (시안 입력값 카드 · 상세 축약)', () => { it('the 입력값 card has the nine rows of the mockup', () => { const rows = abutInputRows(rec); expect(rows).toHaveLength(9); expect(rows[1]).toEqual(['교좌면 EL (구간 ①)', '44.367 m']); expect(rows[0][1]).toMatch(/^A1 \(시점\) · /); expect(rows[8][1]).toBe('5개 · z = 패드 상면'); }); it('the 상세 shows 8 rows, all of them computed rows of the summary', () => { const all = new Map(abutSummaryRows(rec)); expect(ABUT_DETAIL_LABELS).toHaveLength(8); for (const label of ABUT_DETAIL_LABELS) expect(all.has(label)).toBe(true); }); });