Release v2.5.6
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
require('../src/common');
|
||||
|
||||
const {
|
||||
renderBackgroundTasksPage,
|
||||
renderBackgroundTasksScheduledPage
|
||||
} = require('../src/web/routes/settings/background-tasks-page');
|
||||
|
||||
test('background task pages opt into 24-hour timestamps, confirm clearing tasks, and search by dates', () => {
|
||||
const baseQueueData = {
|
||||
tasks: [
|
||||
{
|
||||
title: 'Example task',
|
||||
key: 'secret-key',
|
||||
category: 'Refresh',
|
||||
status: 'completed',
|
||||
createdAt: '2026-08-04T10:15:00.000Z',
|
||||
startedAt: '2026-08-04T10:16:00.000Z',
|
||||
finishedAt: '2026-08-04T10:17:00.000Z'
|
||||
},
|
||||
{
|
||||
title: 'Older task',
|
||||
key: 'older-key',
|
||||
category: 'Refresh',
|
||||
status: 'completed',
|
||||
createdAt: '2026-08-01T10:15:00.000Z',
|
||||
startedAt: '2026-08-01T10:16:00.000Z',
|
||||
finishedAt: '2026-08-01T10:17:00.000Z'
|
||||
}
|
||||
],
|
||||
summary: { counts: {}, total: 1, activeCount: 0 }
|
||||
};
|
||||
|
||||
const queueHtml = renderBackgroundTasksPage(baseQueueData, '', {
|
||||
permissions: ['background-tasks.allow']
|
||||
});
|
||||
|
||||
const queueKeySearchHtml = renderBackgroundTasksPage(Object.assign({}, baseQueueData, { search: 'secret-key' }), '', {
|
||||
permissions: ['background-tasks.allow']
|
||||
});
|
||||
|
||||
const queueDateSearchHtml = renderBackgroundTasksPage(Object.assign({}, baseQueueData, { search: '2026-08-04' }), '', {
|
||||
permissions: ['background-tasks.allow']
|
||||
});
|
||||
|
||||
const scheduledHtml = renderBackgroundTasksScheduledPage(
|
||||
{
|
||||
recurringTasks: [
|
||||
{
|
||||
title: 'Recurring refresh',
|
||||
key: 'refresh',
|
||||
intervalMs: 60000,
|
||||
nextRunAt: '2026-08-04T10:15:00.000Z',
|
||||
lastRunAt: '2026-08-04T09:15:00.000Z'
|
||||
}
|
||||
],
|
||||
summary: { counts: {}, total: 1, activeCount: 0, scheduledCount: 1 }
|
||||
},
|
||||
'',
|
||||
{
|
||||
permissions: ['scheduled-tasks.allow']
|
||||
}
|
||||
);
|
||||
|
||||
assert.match(queueHtml, /data-confirm-message="Clear finished background tasks\?"/);
|
||||
assert.match(queueHtml, /data-local-datetime-format="24h"/);
|
||||
assert.doesNotMatch(queueKeySearchHtml, /Example task/);
|
||||
assert.match(queueDateSearchHtml, /Example task/);
|
||||
assert.match(scheduledHtml, /data-local-datetime-format="24h"/);
|
||||
});
|
||||
Reference in New Issue
Block a user