Files
Pier_v1/tests/shape-options.test.ts
T
ypshimandClaude Haiku 5.5 26a5aff517 feat(ground): 하상 selectable; 설계홍수위 and 세굴 깊이 for 하상
- shape-options: a per-option "confirmed" flag; 하상 is confirmed, 해상 is not.
- The 위치 chips store the choice in the pier's draft; 선택 shows it.
- 하상: the groundwater inputs give way to 설계홍수위 DHWL (floodLevelEl) and
  세굴 깊이 (scourDepthM). The groundwater value is kept (남겨두기).
- Checks: G07 DHWL missing, G08 DHWL below the 지반고, G09 scour negative or
  the scour line below the footing bottom. The groundwater check is skipped for 하상.
- Section: the DHWL as a solid line and the 세굴선 dashed.

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

44 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('하상 is the only confirmed ground option; 해상 stays refused until its rule is confirmed', () => {
const ground = SHAPE_GROUPS.ground[0].options;
expect(ground.find((o) => o.label === '하상')!.confirmed).toBe(true);
expect(() => choose('ground', 0, '해상')).toThrow('규칙 미정');
});