mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
refactor: separate map feature queries and source records
This commit is contained in:
1 parent
a8125ad917
commit
bf1d50f29b
28 files changed
+1128
-675
No files matched your search
@@ -127,3 +127,41 @@ test('road body parsing retains the source request cancellation signal', async (
|
||||
});
|
||||
await assert.rejects(response.json(), { name: 'AbortError' });
|
||||
});
|
||||
|
||||
test('road sources decode direction and coordinates before scene construction', async () => {
|
||||
const geometry = [
|
||||
{ lat: 30, lon: -97 },
|
||||
{ lat: 30.001, lon: -97.001 },
|
||||
];
|
||||
const source = createTrafficSource({
|
||||
fetchImpl: async () =>
|
||||
Response.json({
|
||||
elements: [
|
||||
{ type: 'node', id: 1 },
|
||||
{ type: 'way', geometry, tags: { highway: 'primary', oneway: '-1' } },
|
||||
{ type: 'way', geometry, tags: { junction: 'roundabout' } },
|
||||
{ type: 'way', geometry: [geometry[0]] },
|
||||
],
|
||||
}),
|
||||
});
|
||||
assert.deepEqual(await (await source.requestRoads(bounds)).json(), {
|
||||
roads: [
|
||||
{
|
||||
coordinates: [
|
||||
[-97, 30],
|
||||
[-97.001, 30.001],
|
||||
],
|
||||
type: 'primary',
|
||||
oneway: -1,
|
||||
},
|
||||
{
|
||||
coordinates: [
|
||||
[-97, 30],
|
||||
[-97.001, 30.001],
|
||||
],
|
||||
type: 'unclassified',
|
||||
oneway: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user