Merge pull request 'Fix abort, missing goto, offline schedules and the cron 500' (#66) from fix-known-bugs into main
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 1m41s
CI / Security (npm audit) (push) Successful in 1m0s
CI / Test (jest) (push) Failing after 1m5s
CI / Scan (secrets, workflows, shell) (push) Successful in 4m25s
CI / Integration (api) (push) Failing after 4m31s
CI / UI (playwright) (push) Successful in 5m23s
CI / Deploy (push) Skipped
CI / Deploy worker (push) Skipped
CI / Notify (push) Successful in 4s

This commit was merged in pull request #66.
This commit is contained in:
jared committed 2026-11-23 00:26:30 -05:00
commit 1a031515e7
5 files changed
+166 -32

No files matched your search

+16 -1
View File
@@ -2,7 +2,7 @@
const vm = require('vm');
const { evaluateCondition, checkCondition } = require('../lib/condition');
const { evalCondition, conditionErrors } = require('../lib/utils');
const { evalCondition, conditionErrors, gotoErrors } = require('../lib/utils');
// Every condition used by the production workflows (2026-11-22).
const PRODUCTION = [
@@ -135,3 +135,18 @@ describe('conditionErrors', () => {
expect(conditionErrors('{not json')).toEqual([]);
});
});
describe('gotoErrors (#20)', () => {
test('lists jumps to step ids that do not exist; end is always valid', () => {
const problems = gotoErrors({ steps: [
{ id: 'a', type: 'execute', goto: 'c' },
{ id: 'b', type: 'route', conditions: [{ if: 'true', goto: 'nope' }, { default: true, goto: 'end' }] },
{ id: 'c', type: 'prompt', routes: { Yes: 'a', No: '__end__', Maybe: 'missing' } },
] });
expect(problems.map(p => `${p.step}->${p.goto}`)).toEqual(['b->nope', 'c->missing']);
});
test('accepts a JSON string and ignores malformed JSON', () => {
expect(gotoErrors(JSON.stringify({ steps: [{ id: 'x', goto: 'y' }] }))).toHaveLength(1);
expect(gotoErrors('{oops')).toEqual([]);
});
});