/
nayvok
/
livecoding
Обзор
Документация
Войти
/
nayvok
/
livecoding
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
runner/tests/executionGate.test.ts
26 строк
733 B
nayvok
fix: harden sessions and WebRTC recovery
17 июн 2026, 22:02
17 июн 2026, 22:02
37b9a92
Код
Авторство
О чём код?
import assert from 'node:assert/strict' import { test } from 'node:test' import { createExecutionGate } from '../src/executionGate.ts' test('execution gate allows only the configured number of active runs', () => { const gate = createExecutionGate(1) const release = gate.tryAcquire() assert.equal(typeof release, 'function') assert.equal(gate.tryAcquire(), null) release?.() assert.equal(typeof gate.tryAcquire(), 'function') }) test('execution gate release is idempotent', () => { const gate = createExecutionGate(1) const release = gate.tryAcquire() release?.() release?.() const nextRelease = gate.tryAcquire() assert.equal(typeof nextRelease, 'function') assert.equal(gate.tryAcquire(), null) })