Files
Pier_v1/tests/shape-options.test.ts
T
ypshimandClaude Haiku 5.5 b6e7f36091 feat(ground): 해상 selectable with MSL levels, 고조위·저조위, and checks
- Rules confirmed (승인 2026-10-26): datum MSL; 고조위 HWL and 저조위 LWL as
  two levels; 세굴 깊이 as for 하상; 파랑과 선박 하중 excluded from this scope.
- Checks: G13 levels missing, G10 해저면 not below 고조위, G11 저조위 not
  below 고조위, G14 pile wall at or below the corrosion allowance reference.
- CORROSION_ALLOWANCE_MM = 1 is a PLACEHOLDER reference (not in the RAG
  documents); the card and G14 mark it as to be confirmed.
- Card: the 해상 inputs; the section draws 고조위 (solid), 저조위 (dashed),
  and labels the ground line 해저면 EL.

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

45 lines
1.8 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { choose, defaultSummary, isSelectable, SHAPE_GROUPS, type MemberId } from '../src/core/shape-options';
const MEMBERS: MemberId[] = ['bearing', 'coping', 'column', 'footing', 'ground'];
describe('형상 선택지 (spec §5.2, plan C5)', () => {
it('every group has exactly one default, and it is the 1단계 model', () => {
for (const m of MEMBERS) {
for (const g of SHAPE_GROUPS[m]) {
expect(g.options.filter((o) => o.isDefault)).toHaveLength(1);
}
}
expect(defaultSummary('coping')).toBe('직각 · 직선');
expect(defaultSummary('column')).toBe('원형 · 중실');
expect(defaultSummary('footing')).toBe('직사각 · 없음 · 강관 · 없음');
expect(defaultSummary('ground')).toBe('육상');
});
it('defaults and confirmed options are selectable (하상, 승인 2026-10-26); every other option is refused with the reason', () => {
for (const m of MEMBERS) {
SHAPE_GROUPS[m].forEach((g, gi) => {
for (const o of g.options) {
if (o.isDefault || o.confirmed) {
expect(choose(m, gi, o.label)).toBe(o.label);
} else {
expect(isSelectable(o)).toBe(false);
expect(() => choose(m, gi, o.label)).toThrow('규칙 미정');
}
}
});
}
});
it('an unknown option is refused', () => {
expect(() => choose('coping', 0, '없는선택')).toThrow('알 수 없는');
});
});
it('하상 and 해상 are confirmed ground options (승인 2026-10-26); 육상 is the default', () => {
const ground = SHAPE_GROUPS.ground[0].options;
expect(ground.find((o) => o.label === '하상')!.confirmed).toBe(true);
expect(ground.find((o) => o.label === '해상')!.confirmed).toBe(true);
expect(choose('ground', 0, '해상')).toBe('해상');
});