feat(world): item schema — readable, lightable, lighter, lighterUses

Optional fields used by the new read/light/extinguish dispatcher branches.
Loader updates and dispatcher logic follow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 14:01:31 -05:00
parent ab8c17fdd5
commit df50afa479
4 changed files with 50 additions and 6 deletions
+24
View File
@@ -79,3 +79,27 @@ describe('encounterFrontmatterSchema', () => {
expect(() => encounterFrontmatterSchema.parse(data)).not.toThrow()
})
})
describe('itemFrontmatterSchema — bible additions', () => {
it('accepts readable + lighter fields', () => {
const data = {
id: 'matches',
names: ['matches', 'matchbook'],
short: 'a matchbook',
takeable: true,
lighter: true,
lighterUses: 4,
}
expect(() => itemFrontmatterSchema.parse(data)).not.toThrow()
})
it('accepts lightable on its own', () => {
const data = { id: 'lamp', names: ['lamp'], short: 'a lamp', takeable: true, lightable: true }
expect(() => itemFrontmatterSchema.parse(data)).not.toThrow()
})
it('rejects negative lighterUses', () => {
const data = { id: 'matches', names: ['matches'], short: 'matches', takeable: true, lighter: true, lighterUses: -1 }
expect(() => itemFrontmatterSchema.parse(data)).toThrow()
})
})