import { expect, test } from "bun:test";
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { QuestionView } from "./question-view";
import { AUTH } from "./question-view.test-fixtures";
// Whole original160/178/190/203 callbacks, archive446a9779a937fa5be7cd3eb52fd7f3023d691ed2.
test("a decided card offers Reopen and Discard when allowed", () => {
let markup = renderToStaticMarkup(createElement(QuestionView, {
definition: AUTH,
drafts: {},
status: "answered",
answers: [{
question: "What auth system should we use?",
choices: ["GitHub Apps"],
optionIds: ["b"],
}],
resolver: "ana",
onReopen: () => {},
onDiscard: () => {},
}));
expect(markup).toContain(">Reopen<");
expect(markup).toContain(">Discard<");
});
test("a decided card shows static choices and one linked question heading", () => {
let markup = renderToStaticMarkup(createElement(QuestionView, {
definition: AUTH,
drafts: {},
status: "answered",
answers: [{ question: AUTH.questions[0].question, choices: ["GitHub Apps"], optionIds: ["b"] }],
places: { q: 1 },
onQuestionSelect: () => {},
}));
expect(markup).toContain('class="question-head"');
expect(markup).toContain('class="question-mark"');
expect(markup).toMatch(/
]*>