mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-22 08:19:47 +01:00
enrich commit mentions by internal links e. g. "repoNamespace/repoName@commitId"
This commit is contained in:
@@ -21,7 +21,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
import { isAnchorLink, isExternalLink, isLinkWithProtocol, createLocalLink } from "./MarkdownLinkRenderer";
|
||||
import {
|
||||
isAnchorLink,
|
||||
isExternalLink,
|
||||
isLinkWithProtocol,
|
||||
createLocalLink,
|
||||
isInternalScmRepoLink
|
||||
} from "./MarkdownLinkRenderer";
|
||||
|
||||
describe("test isAnchorLink", () => {
|
||||
it("should return true", () => {
|
||||
@@ -67,6 +73,18 @@ describe("test isLinkWithProtocol", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("test isInternalScmRepoLink", () => {
|
||||
it("should return true", () => {
|
||||
expect(isInternalScmRepoLink("/repo/scmadmin/git/code/changeset/1234567")).toBe(true);
|
||||
expect(isInternalScmRepoLink("/repo/scmadmin/git")).toBe(true);
|
||||
});
|
||||
it("should return false", () => {
|
||||
expect(isInternalScmRepoLink("repo/path/link")).toBe(false);
|
||||
expect(isInternalScmRepoLink("/some/path/link")).toBe(false);
|
||||
expect(isInternalScmRepoLink("#some-anchor")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("test createLocalLink", () => {
|
||||
it("should handle relative links", () => {
|
||||
expectLocalLink("/src", "/src/README.md", "docs/Home.md", "/src/docs/Home.md");
|
||||
|
||||
Reference in New Issue
Block a user