From a591162a67e24ea0dd2b94c2e52aec64e2908204 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Wed, 18 Oct 2023 13:12:06 +0300 Subject: [PATCH] test(clerk-js): Test cases for trimLeadingSlash --- packages/clerk-js/src/utils/__tests__/url.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/clerk-js/src/utils/__tests__/url.test.ts b/packages/clerk-js/src/utils/__tests__/url.test.ts index cd4c075068..b14a33e6b7 100644 --- a/packages/clerk-js/src/utils/__tests__/url.test.ts +++ b/packages/clerk-js/src/utils/__tests__/url.test.ts @@ -15,6 +15,7 @@ import { isValidUrl, mergeFragmentIntoUrl, requiresUserInput, + trimLeadingSlash, trimTrailingSlash, } from '../url'; @@ -239,6 +240,15 @@ describe('trimTrailingSlash(string)', () => { }); }); +describe('trimLeadingSlash(string)', () => { + it('trims all the leading slashes', () => { + expect(trimLeadingSlash('')).toBe(''); + expect(trimLeadingSlash('/foo')).toBe('foo'); + expect(trimLeadingSlash('/foo/')).toBe('foo/'); + expect(trimLeadingSlash('//foo//bar///')).toBe('foo//bar///'); + }); +}); + describe('appendQueryParams(base,url)', () => { it('returns the same url if no params provided', () => { const base = new URL('https://dashboard.clerk.com');