32f098a6fc
* fix: show question icon only for pending input * fix: address pending input review feedback * fix: reduce pending input sidebar complexity * fix: address clarification review comments * test: cover pending clarification hook
24 lines
920 B
TypeScript
24 lines
920 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isValidElement, type ReactNode } from "react";
|
|
import { IconCheck, IconMessageQuestion } from "@tabler/icons-react";
|
|
import { getTaskStateIcon } from "./state-icons";
|
|
|
|
function iconType(node: ReactNode) {
|
|
if (!isValidElement(node)) throw new Error("Expected React element");
|
|
return node.type;
|
|
}
|
|
|
|
describe("getTaskStateIcon", () => {
|
|
it("uses the question icon for waiting-for-input task state", () => {
|
|
expect(iconType(getTaskStateIcon("WAITING_FOR_INPUT"))).toBe(IconMessageQuestion);
|
|
});
|
|
|
|
it("uses the question icon when there is a pending clarification", () => {
|
|
expect(iconType(getTaskStateIcon("REVIEW", undefined, true))).toBe(IconMessageQuestion);
|
|
});
|
|
|
|
it("keeps review task state as the review check without pending clarification", () => {
|
|
expect(iconType(getTaskStateIcon("REVIEW", undefined, false))).toBe(IconCheck);
|
|
});
|
|
});
|