19 lines
758 B
TypeScript
19 lines
758 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { render } from "@testing-library/react";
|
|
import { Markdown } from "./markdown";
|
|
|
|
const md = "hello  world";
|
|
|
|
describe("Markdown images", () => {
|
|
it("renders an <img> by default (SOP pages unchanged)", () => {
|
|
const { container } = render(<Markdown>{md}</Markdown>);
|
|
expect(container.querySelector("img")).not.toBeNull();
|
|
});
|
|
|
|
it("renders no <img> when allowImages is false", () => {
|
|
const { container } = render(<Markdown allowImages={false}>{md}</Markdown>);
|
|
expect(container.querySelector("img")).toBeNull();
|
|
expect(container.textContent).toContain("hello");
|
|
expect(container.textContent).not.toContain("SECRET");
|
|
});
|
|
});
|