Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

629 B
Raw Blame
import assert from "node:assert/strict";
import test from "node:test";
import { WeightedCapacity } from "../src/weighted-capacity.js";

test("weighted capacity owns only numeric attempt-local leases", () => {
  const capacity = new WeightedCapacity(5);
  const first = capacity.tryAcquire(3)!;
  assert.equal(capacity.used, 3);
  assert.equal(capacity.tryAcquire(3), undefined);
  const overflow = capacity.tryAcquire(3, true)!;
  assert.equal(capacity.used, 6);
  assert.equal(capacity.peak, 6);
  first.release();
  first.release();
  assert.equal(capacity.used, 3);
  overflow.release();
  assert.equal(capacity.used, 0);
});