test(analysis): share pseudocode page requests (#17326)

This commit is contained in:
Vincent Koc
2026-12-06 08:38:30 +08:00
committed by GitHub
parent 9f712309da
commit 73c1127c04
@@ -27,43 +27,31 @@ it("preserves the selected document and file-offset without inventing a canonica
artifact: source.artifact,
limitations: source.limitations,
});
const first = projectAnalysisView(source, {
kind: "native",
facet: "pseudocode",
offset: 0,
limit: 2,
});
const pageAt = (offset: number) =>
projectAnalysisView(source, {
kind: "native",
facet: "pseudocode",
offset,
limit: 2,
});
const first = pageAt(0);
if (!first.ok) throw first.error;
expect(first.value).toMatchObject({
procedure_address: null,
item: { text: "A" },
coverage: { next_offset: 1 },
});
const second = projectAnalysisView(source, {
kind: "native",
facet: "pseudocode",
offset: 1,
limit: 2,
});
const second = pageAt(1);
if (!second.ok) throw second.error;
expect(second.value).toMatchObject({
item: { text: "😀" },
coverage: { next_offset: 3 },
});
expect(
projectAnalysisView(source, {
kind: "native",
facet: "pseudocode",
offset: 2,
limit: 2,
}),
).toMatchObject({ ok: false, error: { issues: [{ path: ["view"] }] } });
const beyond = projectAnalysisView(source, {
kind: "native",
facet: "pseudocode",
offset: 100,
limit: 2,
expect(pageAt(2)).toMatchObject({
ok: false,
error: { issues: [{ path: ["view"] }] },
});
const beyond = pageAt(100);
if (!beyond.ok) throw beyond.error;
expect(beyond.value).toMatchObject({
item: { text: "" },