Skip to content

Commit

Permalink
Update Hiscore tests (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwjgit authored Apr 11, 2024
1 parent bb7037a commit 74de580
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const MINIGAMES = [
"pvpArena",
"soulWars",
"riftsClosed",
"colosseumGlory",
] as const;

export const CLUES = ["all", "beginner", "easy", "medium", "hard", "elite", "master"] as const;
Expand Down Expand Up @@ -72,6 +73,7 @@ export const mappedBossNames: [keyof BossRecords, string][] = [
["kraken", "Kraken"],
["kreeArra", "Kree'Arra"],
["krilTsutsaroth", "K'ril Tsutsaroth"],
["lunarChests", "Lunar Chests"],
["mimic", "Mimic"],
["nex", "Nex"],
["nightmare", "The Nightmare"],
Expand All @@ -82,6 +84,7 @@ export const mappedBossNames: [keyof BossRecords, string][] = [
["scorpia", "Scorpia"],
["scurrius", "Scurrius"],
["skotizo", "Skotizo"],
["solHeredit", "Sol Heredit"],
["spindel", "Spindel"],
["tempoross", "Tempoross"],
["theGauntlet", "The Gauntlet"],
Expand Down
2 changes: 2 additions & 0 deletions src/meta/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export interface BossRecords {
kraken: MinigameScore;
kreeArra: MinigameScore;
krilTsutsaroth: MinigameScore;
lunarChests: MinigameScore;
mimic: MinigameScore;
nex: MinigameScore;
nightmare: MinigameScore;
Expand All @@ -98,6 +99,7 @@ export interface BossRecords {
scorpia: MinigameScore;
scurrius: MinigameScore;
skotizo: MinigameScore;
solHeredit: MinigameScore;
spindel: MinigameScore;
tempoross: MinigameScore;
theGauntlet: MinigameScore;
Expand Down
4 changes: 2 additions & 2 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function resolvePlayerFromHiscores(csvData: string, accountType: keyof ty

accumulativeIndex += CLUES.length;

for (let i = 0; i < 4; i++) {
for (let i = 0; i < 5; i++) {
const minigameKey = MINIGAMES[i + 4];
const minigameData = {
rank: Number(data[i + accumulativeIndex][0]),
Expand All @@ -65,7 +65,7 @@ export function resolvePlayerFromHiscores(csvData: string, accountType: keyof ty
resolvedPlayer.minigames[minigameKey] = minigameData;
}

accumulativeIndex += 4;
accumulativeIndex += 5;

for (let i = 0; i < mappedBossNames.length; i++) {
if (!data[i + accumulativeIndex]) continue;
Expand Down
7 changes: 6 additions & 1 deletion test/Hiscores.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ test('Hiscores', async () => {
expect(koru.bossRecords.dagannothPrime.score).toBeGreaterThanOrEqual(1);
expect(koru.bossRecords.dagannothRex.score).toBeGreaterThanOrEqual(1);

const [lynxTitan, zulu, magnaboy, virtualMagnaboy, dmmTournyFaux] = await Promise.all([
const [lynxTitan, zulu, b0aty, magnaboy, virtualMagnaboy, dmmTournyFaux] = await Promise.all([
Hiscores.fetch('Lynx Titan'),
Hiscores.fetch('Zulu'),
Hiscores.fetch('B0aty'),
Hiscores.fetch('Magnaboy'),
Hiscores.fetch('Magnaboy', { virtualLevels: true }),
Hiscores.fetch('Faux', { virtualLevels: true })
Expand Down Expand Up @@ -44,6 +45,10 @@ test('Hiscores', async () => {
expect(zulu.bossRecords.nex.rank > 1).toBe(true);
expect(zulu.bossRecords.nex.score > 150 && zulu.bossRecords.nex.score < 3000).toBe(true);

expect(b0aty.minigames.bountyHunterLegacy.score).toEqual(8)
expect(b0aty.minigames.bountyHunterLegacyRogue.score).toEqual(7)
expect(b0aty.minigames.colosseumGlory.score).toBeGreaterThan(30_000);

expect(magnaboy.clues.all.score).toBe(157);

expect(magnaboy.clues.beginner.score).toBe(6);
Expand Down

0 comments on commit 74de580

Please sign in to comment.