import { describe, expect, it } from "vitest";
import {
  CHECK_PICKUP_IN_REACT_STATE,
  INJECT_REACT_STATE,
  INVOKE_CAPTURED_PLACE_CHANGED,
  TRIGGER_GOOGLE_PLACE_CHANGED,
} from "@/workers/rpa/fix-place/browser-eval-scripts";

describe("fix-place/browser-eval-scripts", () => {
  it("脚本为纯字符串，不含 esbuild helper 引用", () => {
    const scripts = [
      TRIGGER_GOOGLE_PLACE_CHANGED,
      INVOKE_CAPTURED_PLACE_CHANGED,
      CHECK_PICKUP_IN_REACT_STATE,
      INJECT_REACT_STATE,
    ];
    for (const script of scripts) {
      expect(script).not.toMatch(/__name|__assign|__awaiter|__spread/);
      expect(typeof script).toBe("string");
      expect(script.length).toBeGreaterThan(10);
    }
  });
});
