27 lines
858 B
TypeScript
27 lines
858 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { buildThreadContract } from './threadContract';
|
|
|
|
describe('buildThreadContract', () => {
|
|
it('builds a two-step contract for a thread', () => {
|
|
const contract = buildThreadContract({
|
|
thread: {
|
|
id: 'thread-1',
|
|
title: '封桥旧案',
|
|
visibility: 'visible',
|
|
summary: '封桥旧案再次被人提起。',
|
|
conflictType: '调查',
|
|
stakes: '边城安稳',
|
|
involvedFactionIds: [],
|
|
involvedActorIds: ['npc-1'],
|
|
relatedLocationIds: ['bridge'],
|
|
},
|
|
issuerActorId: 'npc-1',
|
|
});
|
|
|
|
expect(contract.steps).toHaveLength(2);
|
|
expect(contract.currentStepId).toBe(contract.steps[0]?.id ?? null);
|
|
expect(contract.steps[0]?.completionSignalIds.some((signalId) => signalId.includes('bridge'))).toBe(true);
|
|
});
|
|
});
|