Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2
3import { hostFreezeNotice } from "./hostFreeze.ts";
4
5const stall = (loadAverage: number, cpuCount: number) => ({
6 detectedAt: "2026-11-29T00:00:00.000Z",
7 durationMs: 5000,
8 loadAverage,
9 cpuCount,
10});
11
12describe("hostFreezeNotice", () => {
13 it("says core, not cores, for a single-core host", () => {
14 expect(hostFreezeNotice("vps", stall(2.1, 1))).toEqual({
15 title: "vps froze for 5s",
16 description: "Its CPU is overloaded (load 2 on 1 core).",
17 });
18 });
19
20 it("says cores for a multi-core host", () => {
21 expect(hostFreezeNotice("box", stall(9.4, 4))?.description).toBe(
22 "Its CPU is overloaded (load 9 on 4 cores).",
23 );
24 });
25});