diff --git a/src/components/StatsUsageReportsGroup.tsx b/src/components/StatsUsageReportsGroup.tsx index c8697f5e0..0313adda9 100644 --- a/src/components/StatsUsageReportsGroup.tsx +++ b/src/components/StatsUsageReportsGroup.tsx @@ -42,22 +42,24 @@ const StatsUsageReportsGroup = ({ <> {inventoryReportsEnabled && library && ( - setShowReportForm(true)) as any} - content={ - <> - Request Report - - > - } - title="Request an inventory report." - disabled={showReportForm} - /> + <> + setShowReportForm(true)) as any} + content={ + <> + Request Report + + > + } + title="Request an inventory report." + disabled={showReportForm} + /> + + These reports provide up-to-date data on both inventory and + holds for library at the time of the request. + + > )} - - These reports provide up-to-date data on both inventory and - holds for library at the time of the request. - > diff --git a/tests/jest/components/Stats.test.tsx b/tests/jest/components/Stats.test.tsx index 731bf79f9..135da76a8 100644 --- a/tests/jest/components/Stats.test.tsx +++ b/tests/jest/components/Stats.test.tsx @@ -389,12 +389,14 @@ describe("Dashboard Statistics", () => { roles, quicksightPagePath: fakeQuickSightHref, }; - const { container, getByRole, queryByRole } = renderWithProviders( - , - { - contextProviderProps, - } - ); + const { + container, + getByRole, + queryByRole, + queryByText, + } = renderWithProviders(, { + contextProviderProps, + }); // We should always render a Usage reports group when a library is specified. getByRole("heading", { @@ -404,11 +406,23 @@ describe("Dashboard Statistics", () => { const usageReportLink = getByRole("link", { name: /View Usage/i }); expect(usageReportLink).toHaveAttribute("href", fakeQuickSightHref); - const result = queryByRole("button", { name: /Request Report/i }); + const requestButton = queryByRole("button", { + name: /Request Report/i, + }); + const blurb = queryByText( + /These reports provide up-to-date data on both inventory and holds/i + ); + + // The inventory report blurb should be visible only when the button is. + if (requestButton) { + expect(blurb).not.toBeNull(); + } else { + expect(blurb).toBeNull(); + } // Clean up the container after each render. document.body.removeChild(container); - return result; + return requestButton; }; // If the feature flag is set, the button should be visible only to sysadmins.