mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-05 12:42:30 +00:00
Bring apps/desktop and ui-tui to a clean state for typecheck, eslint,
and prettier:
- Run prettier across both trees (printWidth/wrap drift; prettier is not
CI-enforced for these JS projects, so main had accumulated drift).
- Apply eslint --fix for padding-line-between-statements and perfectionist
import/export sorting.
- Manual fixes for non-auto-fixable rules:
- remove unused node:net import in electron/main.cjs (uses Electron net)
- replace inline `typeof import(...)` annotations with top-level
`import type * as EnvModule` in two ui-tui test files
- scoped eslint-disable no-control-regex on intentional sentinel/ANSI
regexes (mathUnicode.ts, text.ts)
- resolve react-hooks/exhaustive-deps per-case: correct swapped/missing
deps, collapse redundant session.* members, and justified disables on
settings mount-only data-load effects to preserve run-once behavior
No behavior changes; test pass/fail counts are unchanged from the main
baseline.
29 lines
690 B
TypeScript
29 lines
690 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { mapPool } from './pool'
|
|
|
|
describe('mapPool', () => {
|
|
it('preserves input order regardless of completion order', async () => {
|
|
const out = await mapPool([30, 10, 20], 3, async ms => {
|
|
await new Promise(r => setTimeout(r, ms))
|
|
|
|
return ms
|
|
})
|
|
|
|
expect(out).toEqual([30, 10, 20])
|
|
})
|
|
|
|
it('never exceeds the concurrency limit', async () => {
|
|
let active = 0
|
|
let peak = 0
|
|
|
|
await mapPool([...Array(10).keys()], 3, async () => {
|
|
active += 1
|
|
peak = Math.max(peak, active)
|
|
await new Promise(r => setTimeout(r, 5))
|
|
active -= 1
|
|
})
|
|
|
|
expect(peak).toBeLessThanOrEqual(3)
|
|
})
|
|
})
|