A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.
JavaScript 3d-globecesiumflight-trackinggeospatialgeospatial-intelligencegisosintphotogrammetrysatellite-trackingspatial-intelligencewebglworldview
test: use exported response reader in proxy fixtures
Sameh Khamis2b09352463f6
diff --git a/src/proxyErrorResponses.test.mjs b/src/proxyErrorResponses.test.mjsindex 0ba4ac80f..de02748fb 100644--- a/src/proxyErrorResponses.test.mjs+++ b/src/proxyErrorResponses.test.mjs@@ -2,6 +2,7 @@ import test from 'node:test';import assert from 'node:assert/strict';import { readFileSync } from 'node:fs';import path from 'node:path';+import { readResponseTextCapped } from './sources/httpBody.js';const source = ['local.js', 'common/http.js', 'aircraft/enrichment.js', 'terrain.js', 'space/celestrak.js', 'space/launch-library.js', '../../src/data/spaceProviderRequests.js'].map(file => readFileSync(new URL(`../server/providers/${file}`, import.meta.url), 'utf8'))@@ -20,6 +21,7 @@ function extract(name) {function fixture(name, overrides = {}, preview = false) {const logs = [];const deps = {+ readResponseTextCapped,path, process: { cwd: () => '/fixture', env: {} },fsp: {readFile: async () => { throw new Error('cache absent'); },@@ -34,7 +36,7 @@ function fixture(name, overrides = {}, preview = false) {resolveTerrainHeightRequest: async () => { throw new Error(detail); },...overrides,};- const helpers = ['readResponseTextCapped', 'coalesceProxyRequest', 'launchLibraryRequestHeaders', 'celestrakTleUrl', 'launchLibraryRecentUrl'].map(extract).join('\n');+ const helpers = ['coalesceProxyRequest', 'launchLibraryRequestHeaders', 'celestrakTleUrl', 'launchLibraryRecentUrl'].map(extract).join('\n');const plugin = new Function(...Object.keys(deps), `${helpers}\n${extract(name)}\nreturn ${name}();`)(...Object.values(deps));let middleware;plugin[preview ? 'configurePreviewServer' : 'configureServer']({ middlewares: { use(_route, handler) { middleware = handler; } } });