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.
51 lines
1.4 KiB
51 lines
1.4 KiB
import { describe, expect, it } from "vitest";
|
|
import {
|
|
buildDescriptionProbes,
|
|
labelsMatch,
|
|
suggestionLabelConflicts,
|
|
} from "@/workers/rpa/mothership-styled-suggestion-click";
|
|
|
|
describe("mothership-styled-locator", () => {
|
|
it("buildDescriptionProbes 生成多层文本探针", () => {
|
|
const probes = buildDescriptionProbes(
|
|
"Hollywood Boulevard, Los Angeles, California, USA",
|
|
{
|
|
street: "Hollywood Boulevard",
|
|
city: "Los Angeles",
|
|
state: "CA",
|
|
zip: "",
|
|
},
|
|
);
|
|
expect(probes).toContain("Hollywood Boulevard, Los Angeles, CA");
|
|
expect(probes.some((p) => p.includes("Hollywood"))).toBe(true);
|
|
});
|
|
|
|
it("labelsMatch 支持包含匹配与门牌号", () => {
|
|
expect(
|
|
labelsMatch(
|
|
"1234 Warehouse Street, Los Angeles, CA, USA",
|
|
"1234 Warehouse Street Los Angeles CA",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("labelsMatch 拒绝 Bridge 误匹配", () => {
|
|
expect(
|
|
labelsMatch(
|
|
"1234 Market Street Bridge, Philadelphia, PA, USA",
|
|
"1234 Market Street, Philadelphia, PA, USA",
|
|
),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("suggestionLabelConflicts 识别 Bridge 歧义", () => {
|
|
expect(
|
|
suggestionLabelConflicts(
|
|
"800 Hennepin Avenue Bridge, Minneapolis, MN, USA",
|
|
{ street: "800 Hennepin Avenue", city: "Minneapolis", state: "MN", zip: "" },
|
|
"800 Hennepin Avenue, Minneapolis, MN, USA",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
});
|