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.
32 lines
1.1 KiB
32 lines
1.1 KiB
import { describe, expect, it } from "vitest";
|
|
import { pickBestMothershipCandidate } from "@/scripts/lib/pick-mothership-candidate";
|
|
|
|
describe("pickBestMothershipCandidate", () => {
|
|
it("优先匹配门牌号与城市,惩罚 Bridge 歧义", () => {
|
|
const picked = pickBestMothershipCandidate(
|
|
[
|
|
{
|
|
option_id: "ChIJ-bridge",
|
|
display_label: "1234 Market Street Bridge, Philadelphia, PA, USA",
|
|
formatted_address: "1234 Market Street Bridge, Philadelphia, PA, USA",
|
|
street: "1234 Market Street Bridge",
|
|
city: "Philadelphia",
|
|
state: "PA",
|
|
zip: "",
|
|
},
|
|
{
|
|
option_id: "ChIJ-good",
|
|
display_label: "1234 Market Street, Philadelphia, PA, USA",
|
|
formatted_address: "1234 Market Street, Philadelphia, PA, USA",
|
|
street: "1234 Market Street",
|
|
city: "Philadelphia",
|
|
state: "PA",
|
|
zip: "",
|
|
},
|
|
],
|
|
{ street: "1234 Market Street", city: "Philadelphia", state: "PA" },
|
|
);
|
|
expect(picked?.option_id).toBe("ChIJ-good");
|
|
});
|
|
});
|