aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_photo_sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/test_photo_sync.py')
-rw-r--r--packages/meshbay-hub/tests/test_photo_sync.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/meshbay-hub/tests/test_photo_sync.py b/packages/meshbay-hub/tests/test_photo_sync.py
index 266a111..9ade08b 100644
--- a/packages/meshbay-hub/tests/test_photo_sync.py
+++ b/packages/meshbay-hub/tests/test_photo_sync.py
@@ -57,12 +57,13 @@ doc.visibilityState = 'visible';
globalThis.window = win;
globalThis.document = doc;
globalThis.localStorage = { getItem() { return null; }, setItem() {}, removeItem() {} };
-globalThis.fetch = async (url, opts) => {
- const range = opts && opts.headers && opts.headers.Range;
- fake.log.push(['fetch', url, range || null]);
- const m = /bytes=(\d+)-(\d+)/.exec(range || '');
+globalThis.fetch = async (url) => {
+ // The slice is in the address (platform.js rangedFile), never a header.
+ const [path, query] = url.split('?');
+ const m = /range=(\d+)-(\d+)/.exec(query || '');
+ fake.log.push(['fetch', path, m ? `bytes=${m[1]}-${m[2]}` : null]);
const n = m ? Number(m[2]) - Number(m[1]) + 1 : 4;
- return { ok: true, status: m ? 206 : 200, arrayBuffer: async () => new ArrayBuffer(n),
+ return { ok: true, status: 200, arrayBuffer: async () => new ArrayBuffer(n),
blob: async () => new Blob([new Uint8Array(n)]) };
};