Add ifStuck/stop to frames and captured date to sequences (Refs #23)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 12:24:35 -05:00
parent 32d4b06096
commit 29f44440ca
6 changed files with 45 additions and 6 deletions

View File

@@ -104,6 +104,9 @@ test('sequence validation: layout, image, text, secret, id, title', () => {
bad((x) => { x.frames[0].image = 5; }, /image must be a string/);
bad((x) => { x.frames[0].text = null; }, /text must be a string/);
bad((x) => { x.frames[0].secret = 'yes'; }, /secret must be a boolean/);
bad((x) => { x.frames[0].ifStuck = 5; }, /ifStuck must be a string/);
bad((x) => { x.frames[0].stop = 'yes'; }, /stop must be a boolean/);
bad((x) => { x.captured = 'yesterday'; }, /captured must be YYYY-MM-DD/);
bad((x) => { x.title = ''; }, /missing title/);
bad((x) => { x.id = d.sections[0].records[0].id; }, /duplicate id/);
bad((x) => { delete x.frames; }, /frames must be an array/);
@@ -116,8 +119,11 @@ test('frameLayout hides empty text; frameView withholds secret frames only when
assert.equal(frameLayout({ layout: 'right', text: 'x' }), 'right');
assert.equal(frameLayout({ layout: 'none', text: 'x' }), 'none');
const f = { image: PNG, text: 'pw is hunter2', layout: 'under', secret: true };
assert.deepEqual(frameView(f, false), { withheld: true, image: '', text: '', layout: 'none' });
assert.deepEqual(frameView(f, false), { withheld: true, image: '', text: '', ifStuck: '', stop: false, layout: 'none' });
assert.equal(frameView(f, true).text, 'pw is hunter2');
const g = { image: PNG, text: '', layout: 'none', ifStuck: ' call 555-0100 ', stop: true };
assert.deepEqual([frameView(g, false).ifStuck, frameView(g, false).stop], ['call 555-0100', true]);
assert.deepEqual([frameView({ ...g, secret: true }, false).ifStuck, frameView({ ...g, secret: true }, false).stop], ['', false]);
assert.equal(frameView({ image: '', text: '', layout: 'under', secret: true }, false).withheld, false);
});