Added tasks, reminders, and role-specific dashboards
This commit is contained in:
@@ -34,3 +34,27 @@ test('every role receives its exact merchant scope', () => {
|
||||
assert.deepEqual(merchantScope({ role: 'COMPLIANCE_OFFICER' }), {});
|
||||
assert.deepEqual(merchantScope({ role: 'unexpected' }), { id: '__no_access__' });
|
||||
});
|
||||
|
||||
test('task day boundaries use the viewer time zone through DST and include exact due instants', async () => {
|
||||
const { localDayBounds, taskWhere } = await import('../dist/task-policy.js');
|
||||
for (const [date, hours] of [
|
||||
['2026-03-08T12:00:00Z', 23],
|
||||
['2026-11-01T12:00:00Z', 25],
|
||||
]) {
|
||||
const { start, end } = localDayBounds(new Date(date), 'America/New_York');
|
||||
assert.equal((end - start) / 3600000, hours);
|
||||
}
|
||||
const now = new Date('2026-09-24T22:00:00Z');
|
||||
const { start, end } = localDayBounds(now, 'Europe/Kyiv');
|
||||
assert.equal(start.toISOString(), '2026-09-24T21:00:00.000Z');
|
||||
assert.equal(end.toISOString(), '2026-09-25T21:00:00.000Z');
|
||||
const user = { id: 'manager', role: 'ACCOUNT_MANAGER' };
|
||||
assert.deepEqual(
|
||||
taskWhere(user, { filter: 'TODAY', timeZone: 'Europe/Kyiv' }, now).AND[1].dueAt,
|
||||
{ gte: start, lt: end },
|
||||
);
|
||||
assert.deepEqual(
|
||||
taskWhere(user, { filter: 'UPCOMING', timeZone: 'Europe/Kyiv' }, now).AND[1].dueAt,
|
||||
{ gte: end },
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user