refactor(server): fold the in-container bridge edges

This commit is contained in:
jubnl
2026-08-11 16:32:02 +02:00
parent 0718bd1b0c
commit 2b2c6462ec
18 changed files with 101 additions and 43 deletions
@@ -25,6 +25,9 @@ const baseCtx = {
user: { login_count: 5, first_seen_version: '1.0.0', role: 'user', noTrips: 1 },
currentAppVersion: '2.0.0',
now: new Date('2026-06-01T00:00:00Z'),
// Threaded in by the caller since the addons.bridge import left this module;
// false keeps every case below reading as it did.
addonEnabled: () => false,
};
describe('firstLogin', () => {
@@ -100,3 +103,12 @@ describe('empty conditions', () => {
expect(evaluate(baseNotice, baseCtx)).toBe(true);
});
});
describe('addonEnabled', () => {
it('asks the threaded-in check with the condition addon id', () => {
const notice = noticeWith({ kind: 'addonEnabled', addonId: 'journey' });
expect(evaluate(notice, { ...baseCtx, addonEnabled: (id) => id === 'journey' })).toBe(true);
expect(evaluate(notice, { ...baseCtx, addonEnabled: (id) => id === 'vacay' })).toBe(false);
expect(evaluate(notice, baseCtx)).toBe(false);
});
});