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.

Avoid redundant whole-guide work in documentation checks

pulse-triage[bot]ce68cd04a65a
diff --git a/frontend-modern/src/features/docs/__tests__/installationStartupGuide.test.ts b/frontend-modern/src/features/docs/__tests__/installationStartupGuide.test.ts
index eb569737d0..0b2ba1a7cb 100644
--- a/frontend-modern/src/features/docs/__tests__/installationStartupGuide.test.ts
+++ b/frontend-modern/src/features/docs/__tests__/installationStartupGuide.test.ts
@@ -4,10 +4,17 @@ import { describe, expect, it } from 'vitest';
import { renderDocMarkdown } from '../docMarkdown';
const read = (file: string) => readFileSync(path.resolve(process.cwd(), '..', file), 'utf8');
+const renderedGuides = new Map<string, HTMLElement>();
const article = (name: string) => {
- const result = document.createElement('article');
- result.innerHTML = renderDocMarkdown(read(`docs/${name}.md`), name);
- return result;
+ // These committed guide inputs are immutable for the test run. Parse each
+ // once; clone it so a later assertion cannot mutate another test's fixture.
+ let rendered = renderedGuides.get(name);
+ if (!rendered) {
+ rendered = document.createElement('article');
+ rendered.innerHTML = renderDocMarkdown(read(`docs/${name}.md`), name);
+ renderedGuides.set(name, rendered);
+ }
+ return rendered.cloneNode(true) as HTMLElement;
};
const anchor = 'installation-did-not-reach-a-usable-server';
const section = () => {
diff --git a/frontend-modern/src/utils/__tests__/docsLinks.test.ts b/frontend-modern/src/utils/__tests__/docsLinks.test.ts
index b3e0126be1..1b7ac5951a 100644
--- a/frontend-modern/src/utils/__tests__/docsLinks.test.ts
+++ b/frontend-modern/src/utils/__tests__/docsLinks.test.ts
@@ -83,8 +83,15 @@ describe('docsLinks', () => {
expect(readFileSync(path.join(frontendRoot, 'public/docs/TROUBLESHOOTING.md'), 'utf8')).toBe(
source,
);
+ // Full-guide heading/navigation coverage lives in troubleshootingEntryGuide.
+ // This FAQ regression checks the actual destination section, not an unrelated
+ // sample elsewhere in the ever-growing troubleshooting guide.
+ const heading = '### Memory use keeps growing';
+ const sections = source.split(`${heading}\n`);
+ expect(sections).toHaveLength(2);
+ const memorySection = sections[1].split('\n### ')[0];
const guide = document.createElement('article');
- guide.innerHTML = renderDocMarkdown(source, 'TROUBLESHOOTING');
+ guide.innerHTML = renderDocMarkdown(`${heading}\n${memorySection}`, 'TROUBLESHOOTING');
expect(guide.querySelector('#memory-use-keeps-growing')?.textContent).toBe(
'Memory use keeps growing',
);