feat(content): add action unlock condition schema
This commit is contained in:
@@ -97,3 +97,30 @@ describe('costs and multi-yield', () => {
|
||||
expect(content.actionsById.forage.costs).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('unlock conditions', () => {
|
||||
it('accepts optional minResources and requireStoryFlags', () => {
|
||||
const actions = [
|
||||
{
|
||||
id: 'forage',
|
||||
name: 'Forage',
|
||||
durationMs: 3000,
|
||||
yields: [{ resourceId: 'gold', amount: 1 }],
|
||||
unlock: {
|
||||
minResources: { gold: 10 },
|
||||
requireStoryFlags: ['intro_complete'],
|
||||
},
|
||||
},
|
||||
];
|
||||
const content = buildContent({ resources: validResources, actions });
|
||||
expect(content.actionsById.forage.unlock).toEqual({
|
||||
minResources: { gold: 10 },
|
||||
requireStoryFlags: ['intro_complete'],
|
||||
});
|
||||
});
|
||||
|
||||
it('defaults unlock to undefined when omitted', () => {
|
||||
const content = buildContent({ resources: validResources, actions: validActions });
|
||||
expect(content.actionsById.forage.unlock).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user