| 1 | import { describe, expect, it } from "vitest"; |
| 2 | import { unpackFailure } from "../../src/git/protocol.js"; |
| 3 | |
| 4 | describe("unpack failures", () => { |
| 5 | it("say to split a push that ran out of memory, so clients and the importer push smaller chunks", () => { |
| 6 | expect(unpackFailure(new RangeError("Array buffer allocation failed"))).toBe("the push needs more memory than one push may use; split it into smaller pushes (Array buffer allocation failed)"); |
| 7 | expect(unpackFailure(new Error("Out of memory"))).toMatch(/split it into smaller pushes/); |
| 8 | }); |
| 9 | it("pass other errors through as they are", () => { |
| 10 | expect(unpackFailure(new Error("pack checksum mismatch"))).toBe("pack checksum mismatch"); |
| 11 | expect(unpackFailure("odd")).toBe("odd"); |
| 12 | }); |
| 13 | }); |