forked from phenom/healer-man
Release Healer Man 0.1.16
This commit is contained in:
1 parent
f49e54f35f
commit
b57d2b2839
89 files changed
+6055
-17
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { ARENA_STAGES, VALIDATED_ARENA_STAGES, chooseArenaStage } from "./arena-stages.mjs";
|
||||
|
||||
test("the rated pool contains all eight validated arenas", () => {
|
||||
assert.equal(ARENA_STAGES.length, 8);
|
||||
assert.deepEqual(VALIDATED_ARENA_STAGES.map((stage) => stage.id), ARENA_STAGES.map((stage) => stage.id));
|
||||
});
|
||||
|
||||
test("rated selection covers the pool uniformly and avoids the previous arena", () => {
|
||||
const choices = VALIDATED_ARENA_STAGES.map((_, index, pool) => (
|
||||
chooseArenaStage({ random: () => (index + 0.25) / pool.length })
|
||||
));
|
||||
assert.deepEqual(choices.map((stage) => stage.id), VALIDATED_ARENA_STAGES.map((stage) => stage.id));
|
||||
|
||||
const previousStageId = VALIDATED_ARENA_STAGES[0].id;
|
||||
for (let index = 0; index < VALIDATED_ARENA_STAGES.length - 1; index += 1) {
|
||||
const selected = chooseArenaStage({
|
||||
previousStageId,
|
||||
random: () => (index + 0.25) / (VALIDATED_ARENA_STAGES.length - 1),
|
||||
});
|
||||
assert.notEqual(selected.id, previousStageId);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user