You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { describe, expect, it } from "vitest";
import {
isCargoStateReady,
type CargoStateEvidence,
} from "@/workers/rpa/cargo-state";
describe("isCargoStateReady", () => {
it("hydratingmounted 但无 interactive → not ready", () => {
const evidence: CargoStateEvidence = {
phase: "hydrating",
mountedCargoFields: [{ placeholder: "需要几个托盘?", ariaLabel: null }],
interactiveCargoFields: [],
blockedCargoFields: [
{
placeholder: "需要几个托盘?",
ariaLabel: null,
blockers: ["pointer_events_none"],
},
],
};
expect(isCargoStateReady(evidence)).toBe(false);
});
it("仅 interactive 非托盘字段 → not ready", () => {
const evidence: CargoStateEvidence = {
phase: "interactive",
mountedCargoFields: [{ placeholder: "长度", ariaLabel: null }],
interactiveCargoFields: [{ placeholder: "长度", ariaLabel: null }],
blockedCargoFields: [],
};
expect(isCargoStateReady(evidence)).toBe(false);
});
it("托盘 interactive → ready", () => {
const evidence: CargoStateEvidence = {
phase: "interactive",
mountedCargoFields: [{ placeholder: "需要几个托盘?", ariaLabel: null }],
interactiveCargoFields: [
{ placeholder: "需要几个托盘?", ariaLabel: null },
],
blockedCargoFields: [],
};
expect(isCargoStateReady(evidence)).toBe(true);
});
});