mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-21 02:42:07 -05:00
* Initial * Faster user page * Remove redundant function * Favorite badge sorting * Upgrade deps * Simplify entry.server * Bun tests initial * Update package.json npm -> bun * Update README * Type safe translations again * Don't load streams info for finalized tournaments * Translations as an object * More unit test work * Convert match.server.test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * test * Test & all done * Working cf * Bun GA try * No cache * spacing * spacing 2 * Add SQL logging * Remove NR * Hmm * Hmm 2 * Interesting * SKALOP_SYSTEM_MESSAGE_URL * . * . * ? * . * ? * Server.ts adjust * Downgrade Tldraw * E2E test fix * Fix lint
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import type { AbilityWithUnknown } from "~/modules/in-game-lists/types";
|
|
import { buildToAbilityPoints } from "./utils";
|
|
|
|
describe("buildToAbilityPoints", () => {
|
|
const EMPTY_ROW: [
|
|
AbilityWithUnknown,
|
|
AbilityWithUnknown,
|
|
AbilityWithUnknown,
|
|
AbilityWithUnknown,
|
|
] = ["UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN"];
|
|
|
|
test("calculates ability points correctly", () => {
|
|
const aps = buildToAbilityPoints([
|
|
["SS", "SS", "RSU", "RSU"],
|
|
EMPTY_ROW,
|
|
EMPTY_ROW,
|
|
]);
|
|
|
|
expect(aps.get("SS")).toBe(13);
|
|
expect(aps.get("RSU")).toBe(6);
|
|
expect(aps.get("UNKNOWN")).toBe(38);
|
|
});
|
|
|
|
test("handles ability doubler correctly", () => {
|
|
const aps = buildToAbilityPoints([
|
|
EMPTY_ROW,
|
|
["AD", "SS", "UNKNOWN", "UNKNOWN"],
|
|
EMPTY_ROW,
|
|
]);
|
|
|
|
expect(aps.get("SS")).toBe(6);
|
|
});
|
|
|
|
test("does not calculate AP for main only abilities", () => {
|
|
const aps = buildToAbilityPoints([
|
|
["LDE", "SS", "RSU", "RSU"],
|
|
EMPTY_ROW,
|
|
EMPTY_ROW,
|
|
]);
|
|
|
|
expect(aps.has("LDE")).toBeFalsy();
|
|
});
|
|
});
|