Show read-only server reading hours in settings

This commit is contained in:
Codex committed 2026-10-14 22:42:54 +02:00
1 parent de8e7ed988
commit ddd9c62c40
9 files changed
+89 -7

No files matched your search

+10 -1
View File
@@ -1,7 +1,7 @@
'use strict';
const test = require('node:test');
const assert = require('node:assert/strict');
const { SETTINGS_SECTIONS, SCRAPER_TABS, settingsRoute } = require('../public/settings-nav');
const { SETTINGS_SECTIONS, SCRAPER_TABS, settingsRoute, readingDayText } = require('../public/settings-nav');
test('settings organize unique routes into User and Admin, with scraper-local tabs', () => {
assert.equal(new Set(SETTINGS_SECTIONS.map(s => s.id)).size, SETTINGS_SECTIONS.length);
@@ -21,3 +21,12 @@ test('settings deep links default safely and never route ordinary readers into a
assert.deepEqual(settingsRoute('#admin/scraper/sources', true), { id: 'admin/scraper', tab: 'sources' });
assert.equal(settingsRoute('#admin/scraper/unknown', true).tab, 'activity');
});
test('reading-hours rows include overnight carry from the previous day', () => {
const schedule = { days: [
[['08:00', '01:00']], [['07:00', '24:00']], [], [], [], [], [['08:00', '01:00']],
] };
assert.equal(readingDayText(schedule, 0), '00:00–01:00 (from Saturday) · 08:00–01:00 (next day)');
assert.equal(readingDayText(schedule, 1), '00:00–01:00 (from Sunday) · 07:00–24:00');
assert.equal(readingDayText(schedule, 2), 'Closed all day');
});