2020-02-10 12:50:13 -07:00

19 lines
431 B
JavaScript

import tape from 'tape';
import ptape from 'tape-promise';
import { handleResponse } from './main';
import fetch from 'node-fetch';
const test = ptape(tape);
test('handleResponse', async t => {
return fetch('https://api.github.com/users/bcomnes/repos')
.then(response => {
t.ok(response.ok);
return response;
})
.then(handleResponse)
.then(json => {
t.ok(json);
})
.catch(t.error);
});