Cover byte-range parsing invalid file-size inputs

Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
Cursor AgentandTheo Browne committed 2026-02-10 03:54:47 +00:00
1 parent 390c340bdc
commit 9dffec959c
1 file changed
+5
+5
View File
@@ -895,6 +895,11 @@ describe("parseByteRangeHeader", () => {
expect(parseByteRangeHeader(undefined, 100)).toBeNull();
});
it("rejects non-integer and negative file sizes", () => {
expect(parseByteRangeHeader("bytes=0-1", -1)).toBe("invalid");
expect(parseByteRangeHeader("bytes=0-1", 1.5)).toBe("invalid");
});
it("parses explicit start/end ranges", () => {
expect(parseByteRangeHeader("bytes=0-9", 100)).toEqual({
start: 0,