mirror of
https://github.com/ZSCGR/CloudFlare-ImgBed.git
synced 2026-08-13 04:03:42 +08:00
chore: remove batch deletion test file
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { mapConcurrent, normalizeBatchFileIds } from '../functions/utils/deleteBatch.js';
|
||||
|
||||
describe('delete batch helpers', function () {
|
||||
it('normalizes and deduplicates file ids', function () {
|
||||
assert.deepEqual(normalizeBatchFileIds([' /a.png ', 'a.png', 'folder/b.png', ''], 500), [
|
||||
'a.png',
|
||||
'folder/b.png',
|
||||
]);
|
||||
});
|
||||
|
||||
it('rejects more than 500 file ids', function () {
|
||||
assert.throws(
|
||||
() => normalizeBatchFileIds(Array.from({ length: 501 }, (_, index) => `${index}.png`), 500),
|
||||
/500/,
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps result ordering while bounding concurrency', async function () {
|
||||
let active = 0;
|
||||
let maxActive = 0;
|
||||
const results = await mapConcurrent([3, 1, 2, 4], 2, async (value) => {
|
||||
active += 1;
|
||||
maxActive = Math.max(maxActive, active);
|
||||
await new Promise((resolve) => setTimeout(resolve, value));
|
||||
active -= 1;
|
||||
return value * 2;
|
||||
});
|
||||
assert.deepEqual(results, [6, 2, 4, 8]);
|
||||
assert.equal(maxActive, 2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user