import { describe, expect, it } from "vitest"; import { createEloRating, scoreForVerdict, updateEloPair } from "./elo.js"; describe("elo", () => { it("updates equal ratings by the standard K=32 margin", () => { const control = createEloRating("control"); const variant = createEloRating("variant"); const updated = updateEloPair(control, variant, 1); expect(updated.ratingA.elo).toBe(1516); expect(updated.ratingB.elo).toBe(1484); expect(updated.ratingA.matches).toBe(1); expect(updated.ratingA.wins).toBe(1); }); it("maps side-by-side verdicts to scores", () => { expect(scoreForVerdict("A")).toBe(1); expect(scoreForVerdict("B")).toBe(0); expect(scoreForVerdict("tie")).toBe(0.5); }); });