mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Rename properties for clarity, add formatted names
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import {
|
||||
parseStats,
|
||||
getRSNFormat,
|
||||
getSkillPage,
|
||||
getStats,
|
||||
getStatsByGamemode,
|
||||
getRSNFormat,
|
||||
Stats,
|
||||
} from '../src/index';
|
||||
|
||||
test('Parse CSV to json', () => {
|
||||
@@ -81,10 +82,10 @@ test('Parse CSV to json', () => {
|
||||
1923,272
|
||||
8484,1340
|
||||
599,1694
|
||||
-1,-1
|
||||
12489,435
|
||||
3810,4583`;
|
||||
|
||||
expect(parseStats(csv)).toStrictEqual({
|
||||
const expectedOutput: Stats = {
|
||||
skills: {
|
||||
overall: { rank: 40258, level: 2063, xp: 218035714 },
|
||||
attack: { rank: 20554, level: 99, xp: 21102621 },
|
||||
@@ -111,11 +112,12 @@ test('Parse CSV to json', () => {
|
||||
hunter: { rank: 169127, level: 73, xp: 1067670 },
|
||||
construction: { rank: 115543, level: 82, xp: 2546048 },
|
||||
},
|
||||
bh: {
|
||||
leaguePoints: { rank: -1, score: -1 },
|
||||
bountyHunter: {
|
||||
rogue: { rank: -1, score: -1 },
|
||||
hunter: { rank: -1, score: -1 },
|
||||
},
|
||||
lms: { rank: 32875, score: 500 },
|
||||
lastManStanding: { rank: 32875, score: 500 },
|
||||
clues: {
|
||||
all: { rank: 24817, score: 476 },
|
||||
beginner: { rank: 212728, score: 1 },
|
||||
@@ -126,54 +128,56 @@ test('Parse CSV to json', () => {
|
||||
master: { rank: 6293, score: 51 },
|
||||
},
|
||||
bosses: {
|
||||
abyssalsire: { rank: 374, score: 2780 },
|
||||
alchemicalhydra: { rank: 934, score: 3000 },
|
||||
barrowschests: { rank: 1936, score: 1452 },
|
||||
abyssalSire: { rank: 374, score: 2780 },
|
||||
alchemicalHydra: { rank: 934, score: 3000 },
|
||||
barrows: { rank: 1936, score: 1452 },
|
||||
bryophyta: { rank: 4919, score: 23 },
|
||||
chambersofxeric: { rank: 101, score: 4038 },
|
||||
chambersofxericchallengemode: { rank: 152, score: 334 },
|
||||
chaoselemental: { rank: -1, score: -1 },
|
||||
chaosfanatic: { rank: -1, score: -1 },
|
||||
commanderzilyana: { rank: 6806, score: 603 },
|
||||
corporealbeast: { rank: 1, score: 17798 },
|
||||
crazyarchaeologist: { rank: 9160, score: 125 },
|
||||
dagannothprime: { rank: 1021, score: 2802 },
|
||||
dagannothrex: { rank: 4295, score: 1655 },
|
||||
dagannothsupreme: { rank: 959, score: 2951 },
|
||||
derangedarchaeologist: { rank: 10009, score: 1 },
|
||||
generalgraardor: { rank: 1271, score: 2407 },
|
||||
giantmole: { rank: 378, score: 4669 },
|
||||
grotesqueguardians: { rank: 543, score: 1567 },
|
||||
callisto: { rank: -1, score: -1 },
|
||||
cerberus: { rank: -1, score: -1 },
|
||||
chambersOfXeric: { rank: 101, score: 4038 },
|
||||
chambersOfXericChallengeMode: { rank: 152, score: 334 },
|
||||
chaosElemental: { rank: 6153, score: 133 },
|
||||
chaosFanatic: { rank: 4501, score: 250 },
|
||||
commanderZilyana: { rank: 6806, score: 603 },
|
||||
corporealBeast: { rank: 1, score: 17798 },
|
||||
crazyArchaeologist: { rank: 9160, score: 125 },
|
||||
dagannothPrime: { rank: 1021, score: 2802 },
|
||||
dagannothRex: { rank: 4295, score: 1655 },
|
||||
dagannothSupreme: { rank: 959, score: 2951 },
|
||||
derangedArchaeologist: { rank: 10009, score: 1 },
|
||||
generalGraardor: { rank: 1271, score: 2407 },
|
||||
giantMole: { rank: 378, score: 4669 },
|
||||
grotesqueGuardians: { rank: 543, score: 1567 },
|
||||
hespori: { rank: 6003, score: 94 },
|
||||
kalphitequeen: { rank: 263, score: 2897 },
|
||||
kingblackdragon: { rank: 4000, score: 1277 },
|
||||
kalphiteQueen: { rank: 263, score: 2897 },
|
||||
kingBlackDragon: { rank: 4000, score: 1277 },
|
||||
kraken: { rank: 41016, score: 1477 },
|
||||
kreearra: { rank: 617, score: 2391 },
|
||||
kriltsutsaroth: { rank: 120, score: 2981 },
|
||||
kreeArra: { rank: 617, score: 2391 },
|
||||
krilTsutsaroth: { rank: 120, score: 2981 },
|
||||
mimic: { rank: 1, score: 109 },
|
||||
obor: { rank: 26, score: 323 },
|
||||
sarachnis: { rank: 198, score: 1101 },
|
||||
scorpia: { rank: 81, score: 3404 },
|
||||
skotizo: { rank: 5027, score: 61 },
|
||||
gauntlet: { rank: 63, score: 375 },
|
||||
corruptedgauntlet: { rank: 2845, score: 6 },
|
||||
theatreofblood: { rank: 6913, score: 138 },
|
||||
thermonuclearsmokedevil: { rank: 3999, score: 2000 },
|
||||
tzkalzuk: { rank: 484, score: 8 },
|
||||
tztokjad: { rank: 957, score: 47 },
|
||||
corruptedGauntlet: { rank: 2845, score: 6 },
|
||||
theatreOfBlood: { rank: 6913, score: 138 },
|
||||
thermonuclearSmokeDevil: { rank: 3999, score: 2000 },
|
||||
tzKalZuk: { rank: 484, score: 8 },
|
||||
tzTokJad: { rank: 957, score: 47 },
|
||||
venenatis: { rank: 10987, score: 223 },
|
||||
vetion: { rank: 1923, score: 272 },
|
||||
vorkath: { rank: 8484, score: 1340 },
|
||||
wintertodt: { rank: 599, score: 1694 },
|
||||
zalcano: { rank: -1, score: -1 },
|
||||
zalcano: { rank: 12489, score: 435 },
|
||||
zulrah: { rank: 3810, score: 4583 },
|
||||
callisto: { rank: -1, score: -1 },
|
||||
cerberus: { rank: -1, score: -1 },
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
expect(parseStats(csv)).toStrictEqual(expectedOutput);
|
||||
});
|
||||
|
||||
test('Get rsn format', async () => {
|
||||
test('Get name format', async () => {
|
||||
jest.setTimeout(30000);
|
||||
const data = await getRSNFormat('lYnX tiTaN');
|
||||
expect(data).toBe('Lynx Titan');
|
||||
@@ -184,169 +188,169 @@ test('Get attack top page', async () => {
|
||||
const data = await getSkillPage('attack');
|
||||
expect(data).toMatchObject([
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 1,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 2,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{ rsn: 'Drakon', rank: 3, level: 99, xp: 200000000, dead: false },
|
||||
{ name: 'Drakon', rank: 3, level: 99, xp: 200000000, dead: false },
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 4,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 5,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 6,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 7,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 8,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 9,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 10,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 11,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 12,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 13,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 14,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 15,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 16,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 17,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 18,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 19,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 20,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 21,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 22,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 23,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 24,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
dead: false,
|
||||
},
|
||||
{
|
||||
rsn: expect.any(String),
|
||||
name: expect.any(String),
|
||||
rank: 25,
|
||||
level: 99,
|
||||
xp: 200000000,
|
||||
|
Reference in New Issue
Block a user