Make source-text guardrail assertions tolerant of prettier wrapping

settingsArchitecture and WorkloadsSurface.performance.contract pin exact
source text (JSX copy phrases, a single-line export list) that prettier
line-wraps at printWidth 100. Normalize whitespace for the copy-phrase
guards and match the export list with a wrapping-tolerant regex so a
formatting pass cannot break them. Prep for the repo-wide prettier sweep.
This commit is contained in:
rcourtman
2026-07-20 10:30:53 +01:00
parent f2fa92f576
commit 84c7667305
2 changed files with 18 additions and 12 deletions
@@ -1053,19 +1053,24 @@ describe('settings architecture guardrails', () => {
});
it('keeps settings copy aligned with Infrastructure as the default workspace', () => {
expect(settingsHeaderMetaSource).toContain(
// Copy phrases are matched against whitespace-normalized source so
// prettier line-wrapping inside JSX text cannot break the guard.
const normalize = (source: string) => source.replace(/\s+/g, ' ');
expect(normalize(settingsHeaderMetaSource)).toContain(
'Manage appearance, layout, and default monitoring cadence.',
);
expect(generalSettingsPanelSource).not.toContain('Dashboard, Infrastructure');
expect(networkBoundarySettingsSectionSource).toContain('Pulse URL for Notifications');
expect(networkBoundarySettingsSectionSource).not.toContain('Dashboard URL for Notifications');
expect(nodeModalBasicInfoSectionSource).toContain('monitoring views');
expect(nodeModalBasicInfoSectionSource).not.toContain('dashboards');
expect(nodeModalMonitoringSectionSource).toContain('trim workload noise');
expect(nodeModalMonitoringSectionSource).toContain('Existing monitoring readings');
expect(nodeModalMonitoringSectionSource).not.toContain('dashboard readings');
expect(recoverySettingsPanelSource).toContain('Required for workload backup status');
expect(recoverySettingsPanelSource).not.toContain('dashboard backup status');
expect(normalize(generalSettingsPanelSource)).not.toContain('Dashboard, Infrastructure');
expect(normalize(networkBoundarySettingsSectionSource)).toContain('Pulse URL for Notifications');
expect(normalize(networkBoundarySettingsSectionSource)).not.toContain(
'Dashboard URL for Notifications',
);
expect(normalize(nodeModalBasicInfoSectionSource)).toContain('monitoring views');
expect(normalize(nodeModalBasicInfoSectionSource)).not.toContain('dashboards');
expect(normalize(nodeModalMonitoringSectionSource)).toContain('trim workload noise');
expect(normalize(nodeModalMonitoringSectionSource)).toContain('Existing monitoring readings');
expect(normalize(nodeModalMonitoringSectionSource)).not.toContain('dashboard readings');
expect(normalize(recoverySettingsPanelSource)).toContain('Required for workload backup status');
expect(normalize(recoverySettingsPanelSource)).not.toContain('dashboard backup status');
});
it('keeps cluster member address edits on the durable IPOverride boundary', () => {
@@ -1394,7 +1394,8 @@ describe('Workloads performance contract', () => {
expect(guestRowStateSource).not.toContain('rowStyle');
expect(guestRowStateSource).not.toContain('box-shadow');
expect(guestRowStateSource).toContain('getWorkloadTypeBadge');
expect(guestRowCellsSource).toContain('export { AvailabilityProbeCell');
// Wrapping-tolerant: prettier may break the export list across lines.
expect(guestRowCellsSource).toMatch(/export \{[^}]*\bAvailabilityProbeCell\b/);
expect(guestRowCellsSource).toContain('function NetworkInfoCell(');
expect(guestRowCellsSource).toContain('function OSInfoCell(');
expect(guestRowCellsSource).toContain('useTooltip');