mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
test: cover read-only profile summary
- Render bounded profile details\n- Exclude profile mutation controls
This commit is contained in:
1 parent
60f91d27d7
commit
e2d308ec31
1 file changed
+30
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import { ProfileSummary } from "../profile-summary";
|
||||
|
||||
describe("ProfileSummary", () => {
|
||||
it("renders bounded profile information without mutation controls", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<I18nProvider initialLocale="en">
|
||||
<ProfileSummary
|
||||
summary={{
|
||||
allergies: [{ substance: "Pollen", category: "OTHER" }],
|
||||
familyHistory: [
|
||||
{ condition: "Hypertension", relationship: "PARENT" },
|
||||
],
|
||||
facts: [{ label: "Smoking", value: "Never" }],
|
||||
}}
|
||||
/>
|
||||
</I18nProvider>,
|
||||
);
|
||||
|
||||
expect(html).toContain('data-slot="profile-summary"');
|
||||
expect(html).toContain("Pollen");
|
||||
expect(html).toContain("Hypertension");
|
||||
expect(html).toContain("Smoking");
|
||||
expect(html).not.toContain("<button");
|
||||
expect(html).not.toContain("<form");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user