mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Add test for non-existant player
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { parseStats, getRSNFormat, getSkillPage } from '../src/index';
|
import { parseStats, getRSNFormat, getSkillPage, getStats } from '../src/index';
|
||||||
import { PlayerSkillRow } from '../src/types';
|
import { PlayerSkillRow, Player } from '../src/types';
|
||||||
|
import axios, { AxiosError } from 'axios';
|
||||||
|
|
||||||
test('Parse CSV to json', () => {
|
test('Parse CSV to json', () => {
|
||||||
const csv = `40258,2063,218035714
|
const csv = `40258,2063,218035714
|
||||||
@@ -208,3 +209,14 @@ test('Get attack top page', async done => {
|
|||||||
|
|
||||||
getSkillPage('attack').then(callback);
|
getSkillPage('attack').then(callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Get non-existant player', async done => {
|
||||||
|
const callback = (err: AxiosError) => {
|
||||||
|
if (err.response) {
|
||||||
|
expect(err.response.status).toBe(404);
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
getStats('fishy').catch(callback);
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user