Fisher-Yates 셔플, 카드 픽 생성, 참고 블록/메타데이터 빌더 구현. Task 4(interpret API)·Task 6(UI)에서 소비됨. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { buildReferenceBlock, buildContextMeta } from '../tarot/reference';
|
|
import { findCard } from '../tarot/cards';
|
|
|
|
const picks = [
|
|
{ card: findCard('the-fool')!, position: '과거', reversed: false },
|
|
{ card: findCard('the-magician')!, position: '현재', reversed: true },
|
|
{ card: findCard('the-high-priestess')!, position: '미래', reversed: false },
|
|
];
|
|
|
|
describe('buildReferenceBlock', () => {
|
|
it('각 카드의 위치·정역·키워드·의미를 텍스트 블록으로 만든다', () => {
|
|
const block = buildReferenceBlock(picks);
|
|
expect(block).toContain('과거');
|
|
expect(block).toContain('The Fool');
|
|
expect(block).toContain('정방향');
|
|
expect(block).toContain('역방향');
|
|
expect(block.length).toBeGreaterThan(50);
|
|
});
|
|
});
|
|
describe('buildContextMeta', () => {
|
|
it('메이저 비율·원소 분포·정역 흐름을 계산한다', () => {
|
|
const meta = buildContextMeta(picks);
|
|
expect(meta.major_minor_ratio).toBe('3:0');
|
|
expect(meta.orientation_flow).toBe('upright→reversed→upright');
|
|
expect(typeof meta.element_distribution).toBe('object');
|
|
});
|
|
});
|