38 lines
2.7 KiB
JavaScript
38 lines
2.7 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
|
|
const root = path.resolve(import.meta.dirname, '../..');
|
|
const page = fs.readFileSync(path.join(root, 'src/web/components/ClientOverviewPage.tsx'), 'utf8');
|
|
const feature = fs.readFileSync(path.join(root, 'src/web/features/activity-journal/ActivityJournalFeature.tsx'), 'utf8');
|
|
const styles = fs.readFileSync(path.join(root, 'src/web/styles/features/activity-journal.css'), 'utf8');
|
|
const model = fs.readFileSync(path.join(root, 'src/web/features/activity-journal/activityJournalModel.ts'), 'utf8');
|
|
|
|
test('journal is the last Gateway-only drawer and refreshes whenever it opens', () => {
|
|
assert.match(page, /<RoutingToggle[\s\S]*\{isGateway && <ActivityJournalToggle/);
|
|
assert.match(page, /DRAWER_ORDER = \[[^\]]*'journal'\]/);
|
|
assert.match(feature, /if \(feature\.isOpen\) void load\(null, status !== 'idle'\)/);
|
|
assert.match(feature, /assertActivityJournalPage\(await loadPage\(cursor\)\)/);
|
|
});
|
|
|
|
test('journal presents 30-day grouped history with refresh, pagination and stable states', () => {
|
|
assert.match(feature, /Важные события хранятся 30 дней/);
|
|
assert.match(feature, /Сегодня[\s\S]*Вчера/);
|
|
assert.match(feature, /Обновить журнал/);
|
|
assert.match(feature, /M5 8V4m0 4h4/);
|
|
assert.match(feature, /Показать ещё/);
|
|
assert.match(feature, /Журнал временно недоступен[\s\S]*Повторить/);
|
|
assert.match(styles, /\.client-journal-skeleton/);
|
|
assert.match(styles, /@media \(prefers-reduced-motion: reduce\)/);
|
|
assert.match(feature, /compactActivityJournalEvents\(events\)/);
|
|
assert.match(model, /Подписки обновлялись без ошибок/);
|
|
assert.match(feature, /data-event-type=\{event\.type\}[\s\S]*data-severity=\{event\.severity\}[\s\S]*data-target-role=/);
|
|
assert.match(styles, /\.client-journal-event::before \{[^}]*background: var\(--client-journal-tone\); \}/);
|
|
assert.match(styles, /\.client-journal-event \.client-journal-time span \{ color: var\(--client-journal-tone\); \}/);
|
|
assert.match(styles, /\[data-event-type='subscription\.refreshed'\][\s\S]*\[data-event-type='failover\.recovered'\][\s\S]*--client-journal-tone: var\(--harbor-connect\)/);
|
|
assert.match(styles, /\[data-target-role='reserve'\] \{ --client-journal-tone: var\(--harbor-gateway\); \}/);
|
|
assert.match(styles, /\[data-event-type='failover\.waiting_for_idle'\][\s\S]*\[data-severity='warning'\] \{ --client-journal-tone: oklch\(0\.68 0\.14 72\); \}/);
|
|
assert.match(styles, /\[data-severity='error'\] \{ --client-journal-tone: oklch\(0\.68 0\.15 28\); \}/);
|
|
});
|