- 교대 형상(src/core/abut, 3D 장면, 목록·카메라·맞춤)과 교대 입력 패널 추가 - 교각 받침 기준 카드 제거, 솔플레이트 규칙을 교각별 입력으로 변경 - 받침 ELEVATION·솔플레이트 TABLE을 모델값으로 연결 - 교대 입력값 카드: 형식 행에 시점·종점 표시, 제목을 "A1 입력값 [입력]"으로 변경 - 테스트 614건 통과, 타입 검사 통과 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
54 lines
2.3 KiB
TypeScript
54 lines
2.3 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
import * as XLSX from 'xlsx';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { parseAbutments } from '../src/core/abut/parse';
|
|
import { parseProject, serializeProject, SCHEMA_VERSION, type ProjectFile } from '../src/core/project';
|
|
import { loadP1 } from './helpers';
|
|
|
|
const RAG = fileURLToPath(new URL('../../../RAG/운곡교P1입력.xlsx', import.meta.url));
|
|
const abutments = parseAbutments(XLSX.read(readFileSync(RAG), { type: 'buffer' })).abutments;
|
|
|
|
function project(extra: Partial<ProjectFile> = {}): ProjectFile {
|
|
return {
|
|
schemaVersion: SCHEMA_VERSION,
|
|
project: { name: '운곡교 교각', bridge: '운곡교', client: '', author: '', crs: 'KATEC', memo: '' },
|
|
source: { fileName: '운곡교P1입력.xlsx', sheets: ['교각', 'IP', '받침'] },
|
|
piers: [{ id: 'P1', input: loadP1() }],
|
|
history: [],
|
|
...extra,
|
|
};
|
|
}
|
|
|
|
describe('교대 기록의 저장과 불러오기 (AB)', () => {
|
|
it('the A1 record survives a save and open unchanged', () => {
|
|
const text = serializeProject(project({ abutments }));
|
|
const back = parseProject(text);
|
|
expect(back.abutments).toEqual(abutments);
|
|
});
|
|
|
|
it('an old file without abutments opens with none', () => {
|
|
const back = parseProject(serializeProject(project()));
|
|
expect(back.abutments).toBeUndefined();
|
|
});
|
|
|
|
it('a damaged abutment record is refused and the message names it', () => {
|
|
const bad = JSON.parse(JSON.stringify(abutments)) as typeof abutments;
|
|
bad[0].seatEl = NaN as unknown as number;
|
|
expect(() => parseProject(serializeProject(project({ abutments: bad })))).toThrow('A1');
|
|
});
|
|
|
|
it('a wrong 형식 is refused', () => {
|
|
const bad = JSON.parse(JSON.stringify(abutments)) as typeof abutments;
|
|
(bad[0] as unknown as { type: string }).type = 'A3';
|
|
expect(() => parseProject(serializeProject(project({ abutments: bad })))).toThrow('A1 또는 A2');
|
|
});
|
|
|
|
it('the imported defaults are saved and opened with the edited values', () => {
|
|
const edited = abutments.map((a) => ({ ...a, groundEl: 34.5 }));
|
|
const back = parseProject(serializeProject(project({ abutments: edited, abutDefaults: abutments })));
|
|
expect(back.abutments![0].groundEl).toBe(34.5);
|
|
expect(back.abutDefaults).toEqual(abutments);
|
|
});
|
|
});
|