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 rendered guides within documentation link checks

pulse-triage[bot]f1df0e8c6f66
diff --git a/frontend-modern/src/utils/__tests__/alertIncidentActionsHelp.test.ts b/frontend-modern/src/utils/__tests__/alertIncidentActionsHelp.test.ts
index d6f1ae6e30..131570888a 100644
--- a/frontend-modern/src/utils/__tests__/alertIncidentActionsHelp.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertIncidentActionsHelp.test.ts
@@ -86,6 +86,11 @@ describe('existing alert incident actions help', () => {
for (const name of ['CONFIGURATION', 'TROUBLESHOOTING']) {
expect(read(`frontend-modern/public/docs/${name}.md`)).toBe(read(`docs/${name}.md`));
}
+ // Render each immutable guide once instead of reparsing it for every link.
+ const guides: Record<string, HTMLElement> = {
+ CONFIGURATION: article('CONFIGURATION'),
+ TROUBLESHOOTING: article('TROUBLESHOOTING'),
+ };
for (const [from, to, fragment, label] of [
[
'TROUBLESHOOTING',
@@ -100,14 +105,14 @@ describe('existing alert incident actions help', () => {
'Recent delivery activity',
],
]) {
- const link = article(from).querySelector(`a[href="/docs/${to}#${fragment}"]`);
+ const link = guides[from].querySelector(`a[href="/docs/${to}#${fragment}"]`);
expect(link?.textContent).toBe(label);
expect(link?.hasAttribute('data-doc-link')).toBe(true);
- expect(article(to).querySelector(`[id="${fragment}"]`)).not.toBeNull();
+ expect(guides[to].querySelector(`[id="${fragment}"]`)).not.toBeNull();
}
expect(actions().querySelector('a[href="#quiet-hours-and-notification-holds"]')).not.toBeNull();
expect(
- article('CONFIGURATION').querySelector('#quiet-hours-and-notification-holds'),
+ guides.CONFIGURATION.querySelector('#quiet-hours-and-notification-holds'),
).not.toBeNull();
});
});
diff --git a/frontend-modern/src/utils/__tests__/notificationPrivacyHelp.test.ts b/frontend-modern/src/utils/__tests__/notificationPrivacyHelp.test.ts
index fc12536378..418e659446 100644
--- a/frontend-modern/src/utils/__tests__/notificationPrivacyHelp.test.ts
+++ b/frontend-modern/src/utils/__tests__/notificationPrivacyHelp.test.ts
@@ -72,6 +72,10 @@ describe('notification evidence privacy help', () => {
});
it('connects both entry points to existing shipped privacy precautions', () => {
+ const guides: Record<string, HTMLElement> = {
+ WEBHOOKS: article('WEBHOOKS'),
+ TROUBLESHOOTING: article('TROUBLESHOOTING'),
+ };
const cases = [
[
'TROUBLESHOOTING',
@@ -87,9 +91,9 @@ describe('notification evidence privacy help', () => {
],
];
for (const [from, to, href, label] of cases) {
- const link = article(from).querySelector(`a[href="${href}"]`);
+ const link = guides[from].querySelector(`a[href="${href}"]`);
expect(link?.textContent).toBe(label);
- expect(article(to).querySelector(href.slice(href.indexOf('#')))).not.toBeNull();
+ expect(guides[to].querySelector(href.slice(href.indexOf('#')))).not.toBeNull();
}
});
});
diff --git a/frontend-modern/src/utils/__tests__/quietHoursHelp.test.ts b/frontend-modern/src/utils/__tests__/quietHoursHelp.test.ts
index ee354c9578..d61a7bb401 100644
--- a/frontend-modern/src/utils/__tests__/quietHoursHelp.test.ts
+++ b/frontend-modern/src/utils/__tests__/quietHoursHelp.test.ts
@@ -77,6 +77,10 @@ describe('quiet-hours setup help', () => {
});
it('connects troubleshooting and setup through real shipped section links', () => {
+ const guides: Record<string, HTMLElement> = {
+ CONFIGURATION: article('CONFIGURATION'),
+ TROUBLESHOOTING: article('TROUBLESHOOTING'),
+ };
for (const [from, to, fragment, label] of [
[
'TROUBLESHOOTING',
@@ -91,10 +95,10 @@ describe('quiet-hours setup help', () => {
'Recent delivery activity',
],
]) {
- const link = article(from).querySelector(`a[href="/docs/${to}#${fragment}"]`);
+ const link = guides[from].querySelector(`a[href="/docs/${to}#${fragment}"]`);
expect(link?.textContent).toBe(label);
expect(link?.hasAttribute('data-doc-link')).toBe(true);
- expect(article(to).querySelector(`[id="${fragment}"]`)).not.toBeNull();
+ expect(guides[to].querySelector(`[id="${fragment}"]`)).not.toBeNull();
}
});
});