Skip to content

Instantly share code, notes, and snippets.

@gajus
Created July 11, 2019 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gajus/742df5cf1ab10bff744f87ff6c7df02b to your computer and use it in GitHub Desktop.
Save gajus/742df5cf1ab10bff744f87ff6c7df02b to your computer and use it in GitHub Desktop.
test('extends base URL using second URL fragment just like browser would', (t) => {
t.is(resolveUrl('http://foo.com', '/bar'), 'http://foo.com/bar');
t.is(resolveUrl('http://foo.com/bar', './baz'), 'http://foo.com/bar/baz');
t.is(resolveUrl('http://foo.com/bar', '/baz'), 'http://foo.com/baz');
t.is(resolveUrl('http://foo.com/bar/baz', '../qux'), 'http://foo.com/bar/qux');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment