Skip to content

Commit

Permalink
chore: add tests for Url vs URL instances
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Mar 15, 2019
1 parent 70ece78 commit 4cf0975
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'tape';
import { parse } from 'url';
import { parse, URL } from 'url';
import * as httpie from '../src';

// Demo: https://reqres.in/api
Expand Down Expand Up @@ -173,3 +173,17 @@ test('GET (reviver w/ redirect)', async t => {
t.is(typeof res.data.data[1].id, 'string', `~> (deep) converted numbers to strings`);
t.end();
});

test('via Url (legacy)', async t => {
t.plan(5);
let foo = parse('https://reqres.in/api/users/2');
let res = await httpie.get(foo);
isResponse(t, res, 200);
});

test('via URL (WHATWG)', async t => {
t.plan(5);
let foo = new URL('https://reqres.in/api/users/2');
let res = await httpie.get(foo);
isResponse(t, res, 200);
});

0 comments on commit 4cf0975

Please sign in to comment.