Files
shields/frontend/components/markup-modal/path-builder.spec.js
Paul Melnikow 6c2b040fa6 Better modal (#2554)
- With examples using `pattern`s, allow building the URL from its component parts, including the query string.
- Provide a button to copy the link, with an animation.

To enable this for other badges, convert them to use a `pattern`: #1961.
2019-01-10 21:04:07 -05:00

29 lines
683 B
JavaScript

import PathBuilder from './path-builder'
import { test, given } from 'sazerac'
import pathToRegexp from 'path-to-regexp'
describe('<PathBuilder />', function() {
const tokens = pathToRegexp.parse('github/license/:user/:repo')
test(PathBuilder.constructPath, () => {
given({
tokens,
namedParams: {
user: 'paulmelnikow',
repo: 'react-boxplot',
},
}).expect({
path: 'github/license/paulmelnikow/react-boxplot',
isComplete: true,
})
given({
tokens,
namedParams: {
user: 'paulmelnikow',
},
}).expect({
path: 'github/license/paulmelnikow/:repo',
isComplete: false,
})
})
})