mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-27 21:58:08 -05:00
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
import type { MainWeaponId } from "~/modules/in-game-lists/types";
|
|
import { getWeaponsWithRange } from "./weapon-range";
|
|
|
|
// [longerRangeWeaponId, shorterRangeWeaponId]
|
|
const RANGE_COMPARISONS: [MainWeaponId, MainWeaponId][] = [
|
|
[220, 210], // Range Blaster > Blaster
|
|
[70, 40], // Splattershot Pro > Splattershot
|
|
[7010, 7030], // Tri-Stringer > Wellstring V
|
|
[2020, 7030], // Splatterscope > Wellstring V
|
|
[2070, 7010], // Snipewriter 5H > Tri-Stringer
|
|
];
|
|
|
|
describe("getWeaponsWithRange", () => {
|
|
test("keeps a separate slot for each copy of a duplicated weapon", () => {
|
|
const weapons = getWeaponsWithRange([40, 40, 70]);
|
|
|
|
expect(weapons.map((weapon) => weapon.slot)).toEqual([0, 1, 2]);
|
|
});
|
|
});
|
|
|
|
describe("weapon range comparisons", () => {
|
|
test.each(RANGE_COMPARISONS)(
|
|
"weapon %i has more range than weapon %i",
|
|
(longerId, shorterId) => {
|
|
const [longer] = getWeaponsWithRange([longerId]);
|
|
const [shorter] = getWeaponsWithRange([shorterId]);
|
|
|
|
expect(longer.range).toBeGreaterThan(shorter.range);
|
|
},
|
|
);
|
|
});
|