68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
import {
|
|
isReplacementResultMode,
|
|
shouldShowAgentGridResultSection,
|
|
} from "@/lib/agents/generation-result-visibility";
|
|
|
|
function expect(condition: boolean, message: string) {
|
|
if (!condition) {
|
|
throw new Error(message);
|
|
}
|
|
}
|
|
|
|
expect(
|
|
shouldShowAgentGridResultSection({
|
|
activeModeType: "detail_replacement",
|
|
activeResultCount: 0,
|
|
currentModeType: "detail_replacement",
|
|
pendingModeType: "detail_replacement",
|
|
transportIsGenerating: false,
|
|
hasDetailGenerationPlaceholderState: false,
|
|
}),
|
|
"detail replacement must show its result area before the first image returns"
|
|
);
|
|
|
|
expect(
|
|
shouldShowAgentGridResultSection({
|
|
activeModeType: "sku_replacement",
|
|
activeResultCount: 0,
|
|
currentModeType: "sku_replacement",
|
|
pendingModeType: "sku_replacement",
|
|
transportIsGenerating: false,
|
|
hasDetailGenerationPlaceholderState: false,
|
|
}),
|
|
"SKU replacement must show its result area before the first image returns"
|
|
);
|
|
|
|
expect(
|
|
shouldShowAgentGridResultSection({
|
|
activeModeType: "scene_generation",
|
|
activeResultCount: 0,
|
|
currentModeType: "scene_generation",
|
|
pendingModeType: null,
|
|
transportIsGenerating: true,
|
|
hasDetailGenerationPlaceholderState: false,
|
|
}),
|
|
"the active transport must reveal the current result area"
|
|
);
|
|
|
|
expect(
|
|
!shouldShowAgentGridResultSection({
|
|
activeModeType: "detail_replacement",
|
|
activeResultCount: 0,
|
|
currentModeType: "scene_generation",
|
|
pendingModeType: null,
|
|
transportIsGenerating: false,
|
|
hasDetailGenerationPlaceholderState: false,
|
|
}),
|
|
"an inactive empty result category must remain empty"
|
|
);
|
|
|
|
expect(
|
|
isReplacementResultMode("detail_replacement") &&
|
|
isReplacementResultMode("sku_replacement") &&
|
|
!isReplacementResultMode("detail_generation"),
|
|
"only replacement batches should trigger automatic result reveal"
|
|
);
|
|
|
|
console.log("agent generation result visibility tests passed");
|