Files
shields/frontend/lib/resolve-url.spec.js
T
Paul MelnikowandGitHub 7a664ca3e8 Run prettier (#1866)
Merging this separately so the commit with the tooling change is readable. This is a follow-on to #1167 which turned prettier on.
2018-08-08 17:57:14 -04:00

30 lines
780 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'
)
})
})