Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
2.1 kB ยท 67 lines
TSX
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768import { renderToStaticMarkup } from "react-dom/server";import { describe, expect, it } from "vitest";
import { FormCard, FormCardContent, FormCardHeader, FormCardTitle,} from "./form-card";import { FormEmail } from "./form-email";import { FormPassword } from "./form-password";import { FormSubscribeEmail } from "./form-subscribe-email";
const onSubmit = async () => {};
describe("FormEmail", () => { it("renders an empty, labelled email input", () => { const html = renderToStaticMarkup(<FormEmail id="f" onSubmit={onSubmit} />); expect(html).toContain('id="f"'); expect(html).toMatch(/<label[^>]*>Email<\/label>/); expect(html).toMatch(/<input type="email"[^>]*value=""/); });});
describe("FormPassword", () => { it("renders a masked, labelled password input", () => { const html = renderToStaticMarkup(<FormPassword onSubmit={onSubmit} />); expect(html).toMatch(/<label[^>]*>Password<\/label>/); expect(html).toContain('type="password"'); });});
describe("FormSubscribeEmail", () => { it("starts subscribed to the whole page", () => { const html = renderToStaticMarkup( <FormSubscribeEmail onSubmit={onSubmit} />, ); expect(html).toContain('placeholder="subscribe@me.com"'); expect(html).toMatch( /role="checkbox" aria-checked="false"[\s\S]*Subscribe to specific components/, ); expect(html).not.toContain("No components to subscribe to"); });});
describe("FormCard", () => { it("applies the variant border", () => { expect( renderToStaticMarkup(<FormCard variant="destructive">x</FormCard>), ).toContain("border-destructive"); expect( renderToStaticMarkup(<FormCard variant="info">x</FormCard>), ).toContain("border-info"); });
it("composes header, title and content", () => { const html = renderToStaticMarkup( <FormCard> <FormCardHeader> <FormCardTitle>Subscribe</FormCardTitle> </FormCardHeader> <FormCardContent>Body</FormCardContent> </FormCard>, ); expect(html).toMatch(/Subscribe[\s\S]*Body/); });});