mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Add tests
This commit is contained in:
24
hiscores.test.js
Normal file
24
hiscores.test.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const hiscores = require('./hiscores');
|
||||||
|
|
||||||
|
test('Get Lynx Titans stats', async done => {
|
||||||
|
const callback = data => {
|
||||||
|
expect(data.main.stats.overall.level).toBe('2277');
|
||||||
|
expect(data.main.stats.overall.rank).toBe('1');
|
||||||
|
expect(data.main.stats.overall.xp).toBe('4600000000');
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
hiscores.getStats('Lynx Titan', 'main').then(callback);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Ensure correct lengths', async done => {
|
||||||
|
const callback = data => {
|
||||||
|
expect(Object.keys(data.main.stats).length).toBe(24);
|
||||||
|
expect(Object.keys(data.main.clues).length).toBe(7);
|
||||||
|
expect(Object.keys(data.main.bh).length).toBe(2);
|
||||||
|
expect(Object.keys(data.main.lms).length).toBe(2);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
hiscores.getStats('B0aty', 'main').then(callback);
|
||||||
|
});
|
5031
package-lock.json
generated
5031
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -4,8 +4,7 @@
|
|||||||
"description": "The Oldschool Runescape API wrapper that does more!",
|
"description": "The Oldschool Runescape API wrapper that does more!",
|
||||||
"main": "hiscores.js",
|
"main": "hiscores.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "jest"
|
||||||
"start": "node hiscores.js"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -26,5 +25,11 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/maxswa/osrs-json-hiscores/issues"
|
"url": "https://github.com/maxswa/osrs-json-hiscores/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/maxswa/osrs-json-hiscores#readme"
|
"homepage": "https://github.com/maxswa/osrs-json-hiscores#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^0.19.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jest": "^24.8.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user