This commit is contained in:
26
src/services/storyEngine/threadContract.test.ts
Normal file
26
src/services/storyEngine/threadContract.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user