Stream reader results and navigate with cursors [skip ci]

This commit is contained in:
2026-11-07 17:27:31 +08:00
parent b5b1994993
commit ae4a505d70
10 changed files with 149 additions and 46 deletions
+3 -3
View File
@@ -5,14 +5,14 @@ const origin = "https://core.example.test/projects/thesisly/research/";
test("paper transport uses the anonymous no-store API without forwarding site credentials", async () => {
const transport = createPaperTransport(origin, async (url, options) => {
assert.equal(url.href, origin + "papers?q=graph&page=2");
assert.equal(url.href, origin + "papers?q=graph&cursor=opaque");
assert.equal(options.cache, "no-store");
assert.equal(options.redirect, "error");
assert.equal(options.headers, undefined);
assert.ok(options.signal instanceof AbortSignal);
return Response.json({ items: [], total: 0, topics: [], page: 2, pageSize: 8 });
return Response.json({ items: [], nextCursor: "", previousCursor: "", topics: [], pageSize: 8 });
});
assert.deepEqual(await transport("papers?q=graph&page=2"), { ok: true, data: { items: [], total: 0, topics: [], page: 2, pageSize: 8 } });
assert.deepEqual(await transport("papers?q=graph&cursor=opaque"), { ok: true, data: { items: [], nextCursor: "", previousCursor: "", topics: [], pageSize: 8 } });
});
test("HTTP errors stay distinguishable and never become empty search results", async () => {