From ceea69df2fb23436223744daebc9a28ab93f2d46 Mon Sep 17 00:00:00 2001 From: endiliey Date: Tue, 26 Nov 2019 18:26:55 +0700 Subject: [PATCH] test(v2): add more test to normalizeUrl --- 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 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"`, + ); }); });