refactor: separate map feature queries and source records

This commit is contained in:
Sameh Khamis committed 2026-09-15 08:10:32 -07:00
1 parent a8125ad917
commit bf1d50f29b
28 files changed
+1128 -675

No files matched your search

+27
View File
@@ -57,3 +57,30 @@ test('installation response parsing respects cancellation before any follow-on s
{ name: 'AbortError' },
);
});
test('mapped-site sources normalize records and derive saturation from legacy cache metadata', async () => {
const source = createInstallationSource({
fetchImpl: async () =>
Response.json({
elements: [
{
type: 'node',
id: 1,
lat: 30.2,
lon: -97.7,
tags: { military: 'airfield', name: 'Fixture Field' },
},
],
elementCap: 1,
status: 'stale',
retrievedAt: '2026-01-01T00:00:00Z',
}),
});
const payload = await source.getMappedSites(box);
assert.equal(payload.records[0].name, 'Fixture Field');
assert.equal(payload.records[0].latitude, 30.2);
assert.equal(payload.records[0].retrievedAt, '2026-01-01T00:00:00Z');
assert.equal(payload.saturated, true);
assert.equal(payload.status, 'stale');
assert.equal('elements' in payload, false);
});