blob: 4e188c9af7ee1ec83e224df1fe313a4b66acdfca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import gemfileLinker from '~/vue_shared/components/source_viewer/plugins/utils/gemfile_linker';
describe('Highlight.js plugin for linking gemfile dependencies', () => {
it('mutates the input value by wrapping dependency names in anchors', () => {
const inputValue = 'gem </span><span class="hljs-string">'paranoia'';
const outputValue =
'gem </span><span class="hljs-string">'<a href="https://rubygems.org/gems/paranoia" target="_blank" rel="nofollow noreferrer noopener">paranoia</a>'';
const hljsResultMock = { value: inputValue };
const output = gemfileLinker(hljsResultMock);
expect(output).toBe(outputValue);
});
});
|