From 17f66e14a5409c67902088a63eff20208d3c3a14 Mon Sep 17 00:00:00 2001 From: slorber Date: Tue, 21 Jul 2020 18:18:20 +0200 Subject: [PATCH] add test for addLeadingSlash --- packages/docusaurus-utils/src/__tests__/index.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/docusaurus-utils/src/__tests__/index.test.ts b/packages/docusaurus-utils/src/__tests__/index.test.ts index 5c0bc73f119b..5d99871d6a94 100644 --- a/packages/docusaurus-utils/src/__tests__/index.test.ts +++ b/packages/docusaurus-utils/src/__tests__/index.test.ts @@ -25,6 +25,7 @@ import { removeSuffix, removePrefix, getFilePathForRoutePath, + addLeadingSlash, } from '../index'; describe('load utils', () => { @@ -412,6 +413,15 @@ describe('addTrailingSlash', () => { }); }); +describe('addLeadingSlash', () => { + test('should no-op', () => { + expect(addLeadingSlash('/abc')).toEqual('/abc'); + }); + test('should add /', () => { + expect(addLeadingSlash('abc')).toEqual('/abc'); + }); +}); + describe('removeTrailingSlash', () => { test('should no-op', () => { expect(removeTrailingSlash('/abcd')).toEqual('/abcd');