diff --git a/packages/docusaurus-utils/src/__tests__/index.test.ts b/packages/docusaurus-utils/src/__tests__/index.test.ts index ed7fae44ea..dbb7eee1bc 100644 --- a/packages/docusaurus-utils/src/__tests__/index.test.ts +++ b/packages/docusaurus-utils/src/__tests__/index.test.ts @@ -257,9 +257,19 @@ describe('load utils', () => { input: ['http://foobar.com', '', 'test'], output: 'http://foobar.com/test', }, + { + input: ['http://foobar.com', '', 'test', '/'], + output: 'http://foobar.com/test/', + }, ]; asserts.forEach(testCase => { expect(normalizeUrl(testCase.input)).toBe(testCase.output); }); + + expect(() => + normalizeUrl(['http:example.com', undefined]), + ).toThrowErrorMatchingInlineSnapshot( + `"Url must be a string. Received undefined"`, + ); }); });