Add test for non-existant player

This commit is contained in:
Max
2019-06-15 15:23:44 -04:00
parent 79816aaf58
commit d94a3877b0

View File

@@ -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);
});