feat: modernize and harden bot deployment

This commit is contained in:
2026-08-13 18:31:06 +09:00
parent 09ccb03626
commit 061dbf0f3f
18 changed files with 698 additions and 1702 deletions
+19
View File
@@ -0,0 +1,19 @@
import { assertAlmostEquals, assertThrows } from "@std/assert";
import { reactionWeight, scoreForUser, totalScore } from "./scoring.ts";
Deno.test("one reaction by one user scores one point", () => {
assertAlmostEquals(scoreForUser(1), 1);
});
Deno.test("repeat reactions by one user have diminishing weight", () => {
assertAlmostEquals(reactionWeight(2), 1 / 3);
assertAlmostEquals(scoreForUser(3), 1 + 1 / 3 + 1 / 5);
});
Deno.test("total score sums each user's score", () => {
assertAlmostEquals(totalScore([1, 1, 2]), 3 + 1 / 3);
});
Deno.test("invalid reaction counts are rejected", () => {
assertThrows(() => scoreForUser(0), RangeError);
});