feat: support extra health state mechanics
This commit is contained in:
@@ -149,7 +149,7 @@ describe('conditional mechanic persistence adapter', () => {
|
||||
)).toThrow(/inconsistent delivery_duration_seconds metadata/);
|
||||
});
|
||||
|
||||
it('round-trips continuous delivery through normalized rows', async () => {
|
||||
it('round-trips continuous delivery and direct event predicates through normalized rows', async () => {
|
||||
const database = await connect(':memory:');
|
||||
await database.exec(`CREATE TABLE conditional_effect_rules (
|
||||
id TEXT PRIMARY KEY, source_type TEXT, source_id TEXT, configured INTEGER,
|
||||
@@ -276,6 +276,19 @@ describe('conditional mechanic persistence adapter', () => {
|
||||
}
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
key: 'extra-health-state',
|
||||
label: 'Extra Health state',
|
||||
event: 'extra_health_changed',
|
||||
if: {
|
||||
kind: 'compare',
|
||||
left: { source: 'event', path: 'values.hasExtraHealth' },
|
||||
operator: 'eq',
|
||||
right: true
|
||||
},
|
||||
reducer: { kind: 'none' },
|
||||
mutations: [],
|
||||
outcomes: []
|
||||
}]
|
||||
});
|
||||
|
||||
@@ -358,5 +371,14 @@ describe('conditional mechanic persistence adapter', () => {
|
||||
II: { value: 336 }
|
||||
}
|
||||
});
|
||||
expect(loaded?.clauses[1]).toMatchObject({
|
||||
event: 'extra_health_changed',
|
||||
if: {
|
||||
kind: 'compare',
|
||||
left: { source: 'event', path: 'values.hasExtraHealth' },
|
||||
operator: 'eq',
|
||||
right: true
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user