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.

Verify local troubleshooting links as well as guide routes

pulse-triage[bot]746d4477b965
diff --git a/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts b/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts
index 7f6edd4c21..c23338013e 100644
--- a/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts
+++ b/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts
@@ -123,6 +123,10 @@ describe('troubleshooting workflow entry', () => {
'Notification Test works but alerts do not arrive:',
['/docs/TROUBLESHOOTING#test-succeeds-but-real-alerts-are-missing'],
],
+ [
+ 'Usage alert stays open after the reading falls:',
+ ['#usage-alert-stays-open-after-the-reading-falls'],
+ ],
[
'Private information was posted:',
['/docs/TROUBLESHOOTING#if-you-already-posted-private-information'],
@@ -184,12 +188,16 @@ describe('troubleshooting workflow entry', () => {
expect(links.length).toBeGreaterThan(0);
for (const link of links) {
const href = link.getAttribute('href')!;
- const match = /^\/docs\/([^#]+)#(.+)$/.exec(href);
+ // The production viewer preserves local fragments and rewrites Markdown
+ // links to other guides. Both must still lead to a real shipped heading.
+ const match = /^(?:\/docs\/([^#]+))?#(.+)$/.exec(href);
expect(match, href).not.toBeNull();
- const target = renderGuide(match![1]).querySelector(`[id="${match![2]}"]`);
+ const target = renderGuide(match![1] ?? 'TROUBLESHOOTING').querySelector(
+ `[id="${match![2]}"]`,
+ );
expect(target, href).not.toBeNull();
expect(target?.tagName, href).toMatch(/^H[1-6]$/);
- expect(link.hasAttribute('data-doc-link'), href).toBe(true);
+ expect(link.hasAttribute('data-doc-link'), href).toBe(!href.startsWith('#'));
expect(link.hasAttribute('target'), href).toBe(false);
}
});