snapkitty
developer-tools
python
File size: 607 Bytes
39b3fb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import assert from "node:assert/strict";
import test from "node:test";
import { entropyScore, isExecutable } from "../src/shared/entropy.js";

test("entropyScore combines workload, failure pressure, and latency", () => {
  const score = entropyScore({
    dependencies: ["a", "b"],
    failRate: 0.1,
    latencyMs: 500,
  });

  assert.equal(score, 0.12);
});

test("isExecutable blocks high uncertainty tasks", () => {
  assert.equal(
    isExecutable({
      dependencies: ["a", "b", "c", "d", "e", "f"],
      failRate: 0.5,
      latencyMs: 5_000,
    }),
    false,
  );
});