mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
Address artifact PR review feedback
This commit is contained in:
parent
bbf77fcb69
commit
04a19cbc6e
8 changed files with 59 additions and 38 deletions
|
|
@ -134,10 +134,14 @@ function createStorageService(body = Buffer.from("test")): TestStorageService {
|
|||
originalFilename: input.originalFilename,
|
||||
};
|
||||
},
|
||||
getObject: vi.fn(async () => ({
|
||||
stream: Readable.from(body),
|
||||
contentLength: body.length,
|
||||
})),
|
||||
getObject: vi.fn(async (_companyId, _objectKey, options) => {
|
||||
const range = options?.range;
|
||||
const streamBody = range ? body.subarray(range.start, range.end + 1) : body;
|
||||
return {
|
||||
stream: Readable.from(streamBody),
|
||||
contentLength: streamBody.length,
|
||||
};
|
||||
}),
|
||||
headObject: vi.fn(),
|
||||
deleteObject: vi.fn(),
|
||||
};
|
||||
|
|
@ -401,6 +405,11 @@ describe("issue attachment routes", () => {
|
|||
expect(res.headers["content-length"]).toBe("3");
|
||||
expect(res.headers["content-disposition"]).toBe('inline; filename="clip.mp4"');
|
||||
expect(Buffer.from(res.body).toString("utf8")).toBe("bcd");
|
||||
expect(storage.getObject).toHaveBeenCalledWith(
|
||||
"company-1",
|
||||
"issues/issue-1/clip.mp4",
|
||||
{ range: { start: 1, end: 3 } },
|
||||
);
|
||||
});
|
||||
|
||||
it("forces video downloads when the download path is requested", async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue