fix: deduplicate shared fishing plans
This commit is contained in:
@@ -76,3 +76,21 @@ test("plan preserves a real zero confidence and bounds imported text", async ({
|
||||
expect(stored[0].confidence).toBe("0");
|
||||
expect(stored[0].oversized).toBeUndefined();
|
||||
});
|
||||
|
||||
test("plan import deduplicates the same point before applying the five-item cap", async ({ page }) => {
|
||||
await page.goto("/plan");
|
||||
await page.evaluate(() => localStorage.setItem("rf4spotter:fishing-plan", JSON.stringify([
|
||||
{ key: "/spots/vyunok-6331x6332", waterbody: "Вьюнок", coordinates: "6331:6332", confidence: "0" },
|
||||
{ key: "/spots/vyunok-6331x6332", waterbody: "Вьюнок", coordinates: "6331:6332", confidence: "80" },
|
||||
{ key: "/spots/vyunok-7450x7451", waterbody: "Вьюнок", coordinates: "7450:7451", confidence: "40" },
|
||||
])));
|
||||
await page.reload();
|
||||
|
||||
await expect(page.getByText("2 из 5 точек")).toBeVisible();
|
||||
await expect(page.locator(".plan-card")).toHaveCount(2);
|
||||
const stored = await page.evaluate(() => JSON.parse(localStorage.getItem("rf4spotter:fishing-plan") || "[]"));
|
||||
expect(stored.map((item: { key: string }) => item.key)).toEqual([
|
||||
"/spots/vyunok-6331x6332",
|
||||
"/spots/vyunok-7450x7451",
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user