fix: accept zero-length Companion transcripts
This commit is contained in:
@@ -104,6 +104,24 @@ Deno.test("Companion transcript boundary accepts only bounded user-visible items
|
||||
],
|
||||
};
|
||||
assertEquals(parseCompanionTranscriptProjection(fixture), fixture);
|
||||
assertEquals(
|
||||
parseCompanionTranscriptProjection({
|
||||
state: "stopped",
|
||||
start: 0,
|
||||
limit: 0,
|
||||
total: 0,
|
||||
next: null,
|
||||
items: [],
|
||||
}),
|
||||
{
|
||||
state: "stopped",
|
||||
start: 0,
|
||||
limit: 0,
|
||||
total: 0,
|
||||
next: null,
|
||||
items: [],
|
||||
},
|
||||
);
|
||||
|
||||
assertThrows(
|
||||
() =>
|
||||
|
||||
@@ -63,7 +63,7 @@ export function parseCompanionTranscriptProjection(
|
||||
]);
|
||||
const start = boundedInteger(record.start);
|
||||
const limit = boundedInteger(record.limit);
|
||||
if (limit < 1 || limit > MAX_TRANSCRIPT_ITEMS) {
|
||||
if (limit > MAX_TRANSCRIPT_ITEMS) {
|
||||
throw new TypeError("Companion transcript limit is out of range");
|
||||
}
|
||||
const items = boundedArray(record.items, limit).map(parseTranscriptItem);
|
||||
|
||||
Reference in New Issue
Block a user