loqatevars
Version:
Locate JavaScript files with 'const' or 'process.env' usage in LLM-generated codebases
14 lines (13 loc) • 440 B
JavaScript
describe('asyncPool cleanup safety', () => {
test('does not splice when promise not present', () => {
const executing = [Promise.resolve('a'), Promise.resolve('b')];
const e = Promise.resolve('c');
const cleanup = () => {
const idx = executing.indexOf(e);
if (idx > -1) executing.splice(idx, 1);
};
const beforeLen = executing.length;
cleanup();
expect(executing.length).toBe(beforeLen);
});
});