mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
refactor(server): fold the in-container bridge edges
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user