more content length test inputs

This commit is contained in:
mertalev
2025-10-08 01:35:26 -04:00
parent 4d04f80425
commit ebda00fcf0
+8 -3
View File
@@ -319,8 +319,12 @@ describe('/upload', () => {
expect(body).toEqual(errorDto.badRequest('Quota has been exceeded!'));
});
it('should reject when request body is larger than declared content length', async () => {
const length = 1024 * 1024;
// The current implementation depends on the web server to enforce
// this as this case does not even reach app code, but we test a few
// values here to make sure it stays that way.
it.each([1337, 27, 1024 * 1024 + 5, 512 * 512 + 1])(
'should reject when request body is larger than declared content length of %d bytes',
async (length) => {
const content = randomBytes(length);
const { status } = await request(app)
@@ -335,7 +339,8 @@ describe('/upload', () => {
.send(content);
expect(status).toBe(400);
});
},
);
});
describe('resumeUpload', () => {