feat(admin): show deployed app version
This commit is contained in:
@@ -36,3 +36,41 @@ test("notification bell exposes its unread count and keyboard-accessible action"
|
||||
expect(open).toHaveBeenCalledTimes(1);
|
||||
expect(open.mock.calls[0][0]).toBeInstanceOf(HTMLElement);
|
||||
});
|
||||
|
||||
test("shows build metadata only when the caller supplies the admin-only badge", () => {
|
||||
const commonProps = {
|
||||
pageTitle: "Dashboard",
|
||||
breadcrumbs: ["Home"],
|
||||
pathname: "/dashboard",
|
||||
nav: [],
|
||||
navBottom: [],
|
||||
onNavigate: () => undefined,
|
||||
onToggleDrawer: () => undefined,
|
||||
drawerOpen: false,
|
||||
};
|
||||
|
||||
const { rerender } = render(
|
||||
<CssVarsProvider theme={getTheme("light") as any} defaultMode="light">
|
||||
<I18nProvider>
|
||||
<AppShell {...commonProps} buildMetadata={{ version: "2.4.1", commitSha: "abc1234" }}>
|
||||
<div>Content</div>
|
||||
</AppShell>
|
||||
</I18nProvider>
|
||||
</CssVarsProvider>,
|
||||
);
|
||||
|
||||
expect(screen.getByTestId("admin-version-badge")).toHaveTextContent("v2.4.1");
|
||||
expect(screen.getByLabelText("Application version 2.4.1, commit abc1234")).toBeInTheDocument();
|
||||
|
||||
rerender(
|
||||
<CssVarsProvider theme={getTheme("light") as any} defaultMode="light">
|
||||
<I18nProvider>
|
||||
<AppShell {...commonProps}>
|
||||
<div>Content</div>
|
||||
</AppShell>
|
||||
</I18nProvider>
|
||||
</CssVarsProvider>,
|
||||
);
|
||||
|
||||
expect(screen.queryByTestId("admin-version-badge")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user