Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -0,0 +1,34 @@
import { describe, expect, it, vi } from "vitest";
import { generatedStreetNames, validateGeneratedStreets } from "./geodata";
describe("demo-pro geodata validation", () => {
it("builds the exact deterministic street catalog used by the generator", () => {
const names = generatedStreetNames();
expect(names).toHaveLength(60);
expect(new Set(names).size).toBe(names.length);
});
it("detects collisions against paginated official street responses", async () => {
const collision = generatedStreetNames()[3]!;
const fetchMock = vi.fn(async (url: string | URL | Request) => {
const offset = Number(new URL(String(url)).searchParams.get("offset"));
const features =
offset === 0
? Array.from({ length: 500 }, (_, index) => ({ properties: { text: `Unrelated Street ${index}` } }))
: [{ properties: { text: collision } }];
return new Response(JSON.stringify({ numberMatched: 501, features }), { status: 200 });
});
const report = await validateGeneratedStreets(fetchMock as typeof fetch);
expect(report.collisions).toEqual([collision]);
expect(fetchMock).toHaveBeenCalledTimes(2);
});
it("fails closed on an incomplete successful pagination response", async () => {
const fetchMock = vi.fn(
async () => new Response(JSON.stringify({ numberMatched: 501, features: [{ properties: { text: "Only one" } }] }), { status: 200 })
);
await expect(validateGeneratedStreets(fetchMock as typeof fetch)).rejects.toThrow("incomplete");
});
});