From 2f401d7d747fc4612c8ab650e8598ebe3df6866d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 18 Apr 2021 20:48:47 -0400 Subject: [PATCH] test: test times --- test/uploads.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/uploads.js b/test/uploads.js index ae3fe3de6a..8938f95897 100644 --- a/test/uploads.js +++ b/test/uploads.js @@ -81,11 +81,13 @@ describe('Upload Controllers', () => { meta.config.allowedFileExtensions = 'png,jpg,bmp,html'; // why / 2? see: helpers.uploadFile for a weird quirk where we actually upload 2 files per upload in our tests. - async.timesSeries(meta.config.uploadRateLimitThreshold / 2, (i, next) => { + console.log('times', (meta.config.uploadRateLimitThreshold / 2) + 1); + const times = (meta.config.uploadRateLimitThreshold / 2) + 1; + async.timesSeries(times, (i, next) => { helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/503.html'), {}, jar, csrf_token, (err, res, body) => { console.log('limit upload', i, res.statusCode, meta.config.uploadRateLimitThreshold, i + 1 > meta.config.uploadRateLimitThreshold / 2, Date.now()); - if (i + 1 >= meta.config.uploadRateLimitThreshold / 2) { + if (i + 1 >= times) { assert.strictEqual(res.statusCode, 500); assert.strictEqual(body.error, '[[error:upload-ratelimit-reached]]'); } else {