Files
shields/frontend/lib/resolve-url.spec.js
T
Paul MelnikowandGitHub 1eedd458b8 Fix and refactor front-end URL generation (#1322)
- Fix issue in Firefox 57 when run from static build
- Fix color parameter in dynamic badge maker
- Correctly apply maxAge in usage badges
- Follow the WHATWG lead and begin to standardize on URL, not URI (https://url.spec.whatwg.org/#goals)
2017-12-04 10:08:54 -05:00

30 lines
787 B
JavaScript

import { test, given, forCases } from 'sazerac';
import resolveUrl from './resolve-url';
describe('URL resolver', function() {
test(resolveUrl, () => {
forCases([
given('/foo/bar'),
given('/foo/bar', '/'),
given('/foo/bar', '/baz'),
given('/foo/bar', '/baz/'),
given('/foo/bar', ''),
given('/foo/bar', undefined),
]).expect('/foo/bar')
given('foo/bar', '/baz/').expect('/baz/foo/bar')
forCases([
given('http://foo/bar'),
given('bar', 'http://foo/'),
given('/bar', 'http://foo/'),
]).expect('http://foo/bar')
given('/foo/bar', '/baz', { baz: 'bazinga' })
.expect('/foo/bar?baz=bazinga');
given('/foo/bar?thing=1', undefined, { other: '2' })
.expect('/foo/bar?thing=1&other=2');
})
});