summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/harness
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/harness')
-rw-r--r--packages/meshbay-hub/tests/harness/session_harness.mjs6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/harness/session_harness.mjs b/packages/meshbay-hub/tests/harness/session_harness.mjs
index f0d0cb2..3be862e 100644
--- a/packages/meshbay-hub/tests/harness/session_harness.mjs
+++ b/packages/meshbay-hub/tests/harness/session_harness.mjs
@@ -110,6 +110,12 @@ const ctx = {
localStorage, AUTH_KEY, HUB, TOKEN_RENEW_MARGIN_S,
loadAuth, saveAuth, fetch: fakeFetch, atob: (s) => Buffer.from(s, 'base64').toString('binary'),
console,
+ // Hub calls go through the platform adapter since the interface started
+ // shipping in a package: in a browser it is `fetch`, in the application it is
+ // the main process, because an `app://` origin is refused by CORS. The
+ // harness models the browser side, which is the one whose renewal logic this
+ // exercises.
+ platform: { apiFetch: (...args) => fakeFetch(...args) },
};
const fns = new Function(...Object.keys(ctx),
sessionBlock + '\n' + hubFetchFn +