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"); }); });