Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Reuse whole-guide fixtures in documentation safety assertions

pulse-triage[bot]7f883143bdb6
diff --git a/frontend-modern/src/features/docs/__tests__/backupAssessmentTimesGuide.test.ts b/frontend-modern/src/features/docs/__tests__/backupAssessmentTimesGuide.test.ts
index 0e9ea9d3cf..a8e7c74f16 100644
--- a/frontend-modern/src/features/docs/__tests__/backupAssessmentTimesGuide.test.ts
+++ b/frontend-modern/src/features/docs/__tests__/backupAssessmentTimesGuide.test.ts
@@ -33,13 +33,14 @@ describe('backup assessment time guidance', () => {
});
it('explains all three assessment clocks without substituting task, collection or filter times', () => {
- const rows = [...section().querySelectorAll('ul > li')];
+ const currentSection = section();
+ const rows = [...currentSection.querySelectorAll('ul > li')];
expect(rows.map((row) => row.querySelector('strong')?.textContent)).toEqual([
'Evaluated',
'Latest successful point',
'Last verified',
]);
- const text = prose();
+ const text = currentSection.textContent!.replace(/\s+/g, ' ');
for (const distinction of [
"UTC, not your browser's local timezone",
'not when the backup completed or the provider last collected data',
@@ -68,18 +69,21 @@ describe('backup assessment time guidance', () => {
});
it('uses passive comparison and preserves the independent guest-safety path', () => {
- const text = prose();
- expect(section().querySelector('pre')).toBeNull();
+ const currentSection = section();
+ const text = currentSection.textContent!.replace(/\s+/g, ' ');
+ expect(currentSection.querySelector('pre')).toBeNull();
expect(text).toContain('repeated names or VMIDs do not establish identity');
expect(text).toContain('use existing provider records without rerunning collection');
expect(text).toContain('do not run Diagnostics, another backup or a guest-agent probe');
expect(text).toContain('restart monitoring or clear History');
expect(text).toContain('not proof of a tested restore, application health or guest thaw');
expect(text).toContain('does not establish safe workload recovery');
- const safety = section().querySelector('a[href="/docs/VM_DISK_MONITORING#backup-safety"]');
+ const safety = currentSection.querySelector('a[href="/docs/VM_DISK_MONITORING#backup-safety"]');
expect(safety).not.toBeNull();
expect(guide('VM_DISK_MONITORING').querySelector('#backup-safety')).not.toBeNull();
- const archive = section().querySelector('a[href="#local-pve-backups-are-newer-than-coverage"]');
+ const archive = currentSection.querySelector(
+ 'a[href="#local-pve-backups-are-newer-than-coverage"]',
+ );
expect(archive).not.toBeNull();
expect(guide('RECOVERY').querySelector(archive!.getAttribute('href')!)).not.toBeNull();
});
diff --git a/frontend-modern/src/features/docs/__tests__/proxmoxTlsGuide.test.ts b/frontend-modern/src/features/docs/__tests__/proxmoxTlsGuide.test.ts
index fc98c8b718..b89427702c 100644
--- a/frontend-modern/src/features/docs/__tests__/proxmoxTlsGuide.test.ts
+++ b/frontend-modern/src/features/docs/__tests__/proxmoxTlsGuide.test.ts
@@ -1,8 +1,8 @@
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
-import { describe, expect, it } from 'vitest';
-import { renderDocMarkdown, stripLeadingTitle } from '../docMarkdown';
+import { beforeAll, describe, expect, it } from 'vitest';
+import { createGuideFixture } from './guideFixture';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..');
const source = readFileSync(path.join(repoRoot, 'docs/TROUBLESHOOTING.md'), 'utf8');
@@ -10,10 +10,16 @@ const shipped = readFileSync(
path.join(repoRoot, 'frontend-modern/public/docs/TROUBLESHOOTING.md'),
'utf8',
);
+const guide = createGuideFixture(() => shipped);
+
+// Parse and sanitise the complete shipped guide once during suite setup;
+// each assertion still receives an isolated full-document clone.
+beforeAll(() => {
+ guide('TROUBLESHOOTING');
+});
function testScopeSection(): { article: HTMLElement; section: HTMLElement } {
- const article = document.createElement('article');
- article.innerHTML = renderDocMarkdown(stripLeadingTitle(shipped), 'TROUBLESHOOTING');
+ const article = guide('TROUBLESHOOTING');
const heading = article.querySelector('#test-connection-succeeds-but-cluster-polling-fails');
expect(heading?.tagName).toBe('H4');
const section = document.createElement('section');