import { ApprovalRequestId, EnvironmentId } from "@t3tools/contracts"; import type { ReactNode } from "react"; import { renderToStaticMarkup } from "react-dom/server"; import { describe, expect, it, vi } from "vite-plus/test"; vi.mock("react-native", () => ({ View: "div", Pressable: ({ children }: { children: ReactNode }) => , Image: "img", Linking: { openURL: vi.fn() }, })); vi.mock("../../components/AppText", () => ({ AppText: "span" })); vi.mock("../../state/assets", () => ({ useAssetUrl: () => null })); import { QuestionAnswerHistory } from "./QuestionAnswerHistory"; describe("QuestionAnswerHistory", () => { it.each([{}, { text: "Text-only answer", file: "Answer with a file" }])( "renders attachment-only questions alongside text answers: %j", (answers) => { const markup = renderToStaticMarkup( , ); expect(markup.match(/Provide a spec/g)).toHaveLength(1); expect(markup.match(/spec\.txt/g)).toHaveLength(1); expect(markup).toContain("Provide a screenshot"); expect(markup).toContain("shot.png"); for (const answer of Object.values(answers)) expect(markup).toContain(answer); }, ); });