Files
ridebus-board/test/information.test.mjs
Zakhar Timoshenko 5c69f6691d feat: implement night mode functionality with UI updates and journey tracking
- Added NightScreen component for displaying night mode information and alerts.
- Introduced NextStops component to show upcoming stops during a journey.
- Implemented logic for determining night mode activation based on schedule and user settings.
- Created journey utility functions to manage onward journey data and stop information.
- Updated tests to cover new night mode features and journey logic.
- Added fixture for testing night mode scenarios with specific timestamps.
- Removed QR code from night screen for a cleaner UI experience.
- Enhanced admin settings to manage night mode configurations.
2026-10-11 05:04:00 +03:00

20 lines
1.2 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { boardScenes, informationBlocks } from '../src/lib/information.ts';
import { defaultSettings } from '../src/lib/storage.ts';
const off = { ...defaultSettings, infoServiceEnabled: false, infoWeatherEnabled: false, infoQrEnabled: false };
test('disabled information blocks are omitted without leaving gaps in the cycle', () => {
assert.deepEqual(informationBlocks(defaultSettings).map(block => block.id), ['service', 'weather', 'qr']);
assert.deepEqual(informationBlocks({ ...off, infoQrEnabled: true }).map(block => block.id), ['qr']);
assert.deepEqual(informationBlocks({ ...defaultSettings, infoWeatherEnabled: false }).map(block => block.id), ['service', 'qr']);
assert.deepEqual(informationBlocks(off), []);
});
test('all blocks off keeps departures, retains optional advertising, and still surfaces alerts', () => {
assert.deepEqual(boardScenes(off, false, false), ['departures']);
assert.deepEqual(boardScenes({ ...off, adsEnabled: true }, false, false), ['departures', 'ad']);
assert.deepEqual(boardScenes({ ...off, adsEnabled: true }, true, true), ['departures', 'info']);
assert.deepEqual(boardScenes(off, true, false), ['departures', 'info']);
});