test: use render thunks in the read-error family suites for the jsx-key rule

This commit is contained in:
Marc-André Bombeck committed 2026-08-09 04:37:03 +02:00
1 parent edaa5bf424
commit 73b82f444e
2 files changed
+13 -13

No files matched your search

@@ -29,15 +29,15 @@ function render(node: React.ReactNode) {
);
}
const cases: Array<[string, React.ReactNode]> = [
["RecentAuditPreview", <RecentAuditPreview />],
["CoachFeedbackSection", <CoachFeedbackSection />],
["AiQualitySection", <AiQualitySection />],
const cases: Array<[string, () => React.ReactNode]> = [
["RecentAuditPreview", () => <RecentAuditPreview />],
["CoachFeedbackSection", () => <CoachFeedbackSection />],
["AiQualitySection", () => <AiQualitySection />],
];
describe("admin read-error family — a read failure is foreground and recoverable", () => {
it.each(cases)("%s renders a query-error row with retry", (_name, node) => {
const html = render(node);
const html = render(node());
expect(html).toContain('data-slot="query-error-row"');
expect(html).toContain('data-slot="query-error-row-retry"');
expect(html).not.toContain("bg-destructive/10");
@@ -45,18 +45,18 @@ function renderCard(node: React.ReactNode) {
);
}
const cases: Array<[string, React.ReactNode]> = [
["SecuritySessionsCard", <SecuritySessionsCard isAuthenticated />],
["SecurityActivityCard", <SecurityActivityCard isAuthenticated />],
["TrustedDevicesCard", <TrustedDevicesCard isAuthenticated />],
["CoachMemorySection", <CoachMemorySection isAuthenticated />],
["CoachRemindersSection", <CoachRemindersSection isAuthenticated />],
["AboutMeSection", <AboutMeSection isAuthenticated />],
const cases: Array<[string, () => React.ReactNode]> = [
["SecuritySessionsCard", () => <SecuritySessionsCard isAuthenticated />],
["SecurityActivityCard", () => <SecurityActivityCard isAuthenticated />],
["TrustedDevicesCard", () => <TrustedDevicesCard isAuthenticated />],
["CoachMemorySection", () => <CoachMemorySection isAuthenticated />],
["CoachRemindersSection", () => <CoachRemindersSection isAuthenticated />],
["AboutMeSection", () => <AboutMeSection isAuthenticated />],
];
describe("settings read-error family — a read failure is foreground and recoverable", () => {
it.each(cases)("%s renders a query-error row with retry", (_name, node) => {
const html = renderCard(node);
const html = renderCard(node());
expect(html).toContain('data-slot="query-error-row"');
expect(html).toContain('data-slot="query-error-row-retry"');
// No bare red line: the alert is the primitive now.