- 교각 목록 맨 위에 "전체 (N기)" 항목 추가 (기본 선택) - 교각 이름을 누르면 그 교각의 재료표만 표시, 제목·합계 문구도 그 교각 기준 - 범위 규칙을 core/quantity-scope.ts로 분리하고 테스트 4건 추가 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
27 lines
849 B
TypeScript
27 lines
849 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { quantityTargetNames } from '../src/core/quantity-scope';
|
|
|
|
const piers = [
|
|
{ name: 'P1', hasModel: true },
|
|
{ name: 'P2', hasModel: true },
|
|
{ name: 'P3', hasModel: false },
|
|
];
|
|
|
|
describe('quantityTargetNames (④ 재료표 범위)', () => {
|
|
it('is every pier with a model when 전체 is on', () => {
|
|
expect(quantityTargetNames(piers, true, 'P2')).toEqual(['P1', 'P2']);
|
|
});
|
|
|
|
it('is only the chosen pier when 전체 is off', () => {
|
|
expect(quantityTargetNames(piers, false, 'P2')).toEqual(['P2']);
|
|
});
|
|
|
|
it('is empty when the chosen pier has no model', () => {
|
|
expect(quantityTargetNames(piers, false, 'P3')).toEqual([]);
|
|
});
|
|
|
|
it('is empty when no pier is chosen and 전체 is off', () => {
|
|
expect(quantityTargetNames(piers, false, null)).toEqual([]);
|
|
});
|
|
});
|