Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gemspec_linker_spec.js « utils « plugins « source_viewer « components « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3f74bfa117f681912e53284700659b9f095d43b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gemspecLinker from '~/vue_shared/components/source_viewer/plugins/utils/gemspec_linker';

describe('Highlight.js plugin for linking gemspec dependencies', () => {
  it('mutates the input value by wrapping dependency names in anchors', () => {
    const inputValue =
      's.add_dependency(<span class="hljs-string">&#x27;rugged&#x27;</span>, <span class="hljs-string">&#x27;~&gt; 0.24.0&#x27;</span>)';
    const outputValue =
      's.add_dependency(<span class="hljs-string linked">&#x27;<a href="https://rubygems.org/gems/rugged" rel="nofollow noreferrer noopener">rugged</a>&#x27;</span>, <span class="hljs-string">&#x27;~&gt; 0.24.0&#x27;</span>)';
    const hljsResultMock = { value: inputValue };

    const output = gemspecLinker(hljsResultMock);
    expect(output).toBe(outputValue);
  });
});