sendou.ink/app/features/build-analyzer/core/stats.test.ts
Kalle d5413ae0ed Build Analyzer: Fix not showing build value always
Had problem when using only Ninja Squid.
2022-12-29 20:33:31 +02:00

54 lines
1.4 KiB
TypeScript

import { suite } from "uvu";
import * as assert from "uvu/assert";
import { type MainWeaponId, mainWeaponIds } from "~/modules/in-game-lists";
import { damageTypeToWeaponType } from "../analyzer-constants";
import { buildStats } from "./stats";
const AnalyzeBuild = suite("Analyze build");
// TODO: all weapons should have damage
const weaponsWithoutDmg: MainWeaponId[] = [
1000, 1010, 1020, 1030, 1100, 1110, 7010, 7020, 8000, 8010,
/* chill season, */ 1001, 1040, 1101,
];
AnalyzeBuild("Every main weapon has damage", () => {
const weaponsWithoutDamage: MainWeaponId[] = [];
for (const weaponSplId of mainWeaponIds) {
const analyzed = buildStats({
weaponSplId,
});
const hasDamage =
analyzed.stats.damages.filter(
(dmg) => damageTypeToWeaponType[dmg.type] === "MAIN"
).length > 0;
if (!hasDamage && !weaponsWithoutDmg.includes(weaponSplId)) {
weaponsWithoutDamage.push(weaponSplId);
}
}
assert.ok(
weaponsWithoutDamage.length === 0,
`Weapons without damage set: ${weaponsWithoutDamage.join(", ")}`
);
});
AnalyzeBuild("Ninja Squid decreases swim speed", () => {
const analyzed = buildStats({
weaponSplId: 0,
});
const analyzedWithNS = buildStats({
weaponSplId: 0,
mainOnlyAbilities: ["NS"],
});
assert.ok(
analyzed.stats.swimSpeed.value > analyzedWithNS.stats.swimSpeed.value
);
});
AnalyzeBuild.run();