diff --git a/__tests__/hiscores.test.ts b/__tests__/hiscores.test.ts index 27c89c4..1ef28b1 100644 --- a/__tests__/hiscores.test.ts +++ b/__tests__/hiscores.test.ts @@ -1,5 +1,6 @@ -import { parseStats, getRSNFormat, getSkillPage } from '../src/index'; -import { PlayerSkillRow } from '../src/types'; +import { parseStats, getRSNFormat, getSkillPage, getStats } from '../src/index'; +import { PlayerSkillRow, Player } from '../src/types'; +import axios, { AxiosError } from 'axios'; test('Parse CSV to json', () => { const csv = `40258,2063,218035714 @@ -208,3 +209,14 @@ test('Get attack top page', async done => { 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); +});