fix(cctv): release snapshot readers and verify provider error paths

This commit is contained in:
Sameh Khamis committed 2026-09-12 16:37:04 -07:00
1 parent 3d956177ab
commit 24d2582516
5 files changed
+147 -28

No files matched your search

+15
View File
@@ -89,3 +89,18 @@ test('both Places routes answer bad coordinates with a 400 before the limiter an
else process.env.GEV_RATELIMIT_GOOGLE_PER_MIN = previousLimit;
}
});
test('preview validates both Places routes and keeps the keyless response', async () => {
for (const key of ['', 'test-key']) {
const routes = new Map();
googlePlacesContextProxy({ resolveApiKey: () => key }).configurePreviewServer({
middlewares: { use: (path, handler) => routes.set(path, handler) },
});
for (const name of ['nearby-places', 'text-search']) {
const result = await invokeRoute(routes.get(`/api/google/${name}`), { url: '/?q=capitol&lat=&lon=', remoteAddress: 'preview-test' });
assert.equal(result.statusCode, key ? 400 : 200);
assert.deepEqual(result.body.places, []);
if (!key) assert.equal(result.body.configured, false);
}
}
});