Add AI-assisted world and character drafting flows
All checks were successful
CI / validate (push) Successful in 14m3s
All checks were successful
CI / validate (push) Successful in 14m3s
This commit is contained in:
31
packages/shared/src/character.test.ts
Normal file
31
packages/shared/src/character.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { CharacterDraftSchema } from './index'
|
||||
|
||||
const draft = {
|
||||
name: 'Iris Vale',
|
||||
concept: 'A patient relay mechanic who hears impossible harmonics.',
|
||||
abilities: { str: 9, dex: 13, con: 12, int: 16, wis: 14, cha: 10 },
|
||||
hp: 12,
|
||||
maxHp: 12,
|
||||
defense: 13,
|
||||
proficiency: 2,
|
||||
inventory: ['Signal lens', 'Field toolkit'],
|
||||
persona: {
|
||||
voice: 'Precise, with dry humor.',
|
||||
motivation: 'Prove the relay is speaking from the future.',
|
||||
flaw: 'Treats every warning as a puzzle.',
|
||||
bond: 'Will not abandon another crew member.',
|
||||
},
|
||||
}
|
||||
|
||||
describe('CharacterDraftSchema', () => {
|
||||
it('accepts a complete editable 13+ character draft', () => {
|
||||
expect(CharacterDraftSchema.parse(draft)).toEqual(draft)
|
||||
expect(CharacterDraftSchema.toJSONSchema()).toMatchObject({ type: 'object' })
|
||||
})
|
||||
|
||||
it('rejects invalid server-facing mechanics', () => {
|
||||
expect(() => CharacterDraftSchema.parse({ ...draft, hp: 20, maxHp: 10 })).toThrow()
|
||||
expect(() => CharacterDraftSchema.parse({ ...draft, defense: 99 })).toThrow()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user