From 64c83291d1fbc1cf349a886d94714ef88ba328fc Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Wed, 22 Jan 2020 03:18:22 +0300 Subject: [PATCH] Update tests --- .../__snapshots__/routes.test.ts.snap | 6 ++--- .../src/server/__tests__/routes.test.ts | 23 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/docusaurus/src/server/__tests__/__snapshots__/routes.test.ts.snap b/packages/docusaurus/src/server/__tests__/__snapshots__/routes.test.ts.snap index 5a38d6806f73..b91f71b62f9d 100644 --- a/packages/docusaurus/src/server/__tests__/__snapshots__/routes.test.ts.snap +++ b/packages/docusaurus/src/server/__tests__/__snapshots__/routes.test.ts.snap @@ -55,7 +55,7 @@ export default [ ]; ", "routesPaths": Array [ - "404.html", + "/404.html", "/blog", ], } @@ -141,7 +141,7 @@ export default [ ]; ", "routesPaths": Array [ - "404.html", + "/404.html", "/docs/hello", "docs/foo/baz", ], @@ -181,7 +181,7 @@ export default [ ]; ", "routesPaths": Array [ - "404.html", + "/404.html", "", ], } diff --git a/packages/docusaurus/src/server/__tests__/routes.test.ts b/packages/docusaurus/src/server/__tests__/routes.test.ts index 9889478077b1..f21c3ae79eba 100644 --- a/packages/docusaurus/src/server/__tests__/routes.test.ts +++ b/packages/docusaurus/src/server/__tests__/routes.test.ts @@ -36,7 +36,7 @@ describe('loadRoutes', () => { }, ], }; - const result = await loadRoutes([nestedRouteConfig]); + const result = await loadRoutes([nestedRouteConfig], '/'); expect(result).toMatchSnapshot(); }); @@ -64,7 +64,7 @@ describe('loadRoutes', () => { ], }, }; - const result = await loadRoutes([flatRouteConfig]); + const result = await loadRoutes([flatRouteConfig], '/'); expect(result).toMatchSnapshot(); }); @@ -73,20 +73,21 @@ describe('loadRoutes', () => { component: 'hello/world.js', } as RouteConfig; - expect(loadRoutes([routeConfigWithoutPath])).rejects.toMatchInlineSnapshot(` - [Error: Invalid routeConfig (Path must be a string and component is required) - {"component":"hello/world.js"}] - `); + expect(loadRoutes([routeConfigWithoutPath], '/')).rejects + .toMatchInlineSnapshot(` + [Error: Invalid routeConfig (Path must be a string and component is required) + {"component":"hello/world.js"}] + `); const routeConfigWithoutComponent = { path: '/hello/world', } as RouteConfig; - expect(loadRoutes([routeConfigWithoutComponent])).rejects + expect(loadRoutes([routeConfigWithoutComponent], '/')).rejects .toMatchInlineSnapshot(` - [Error: Invalid routeConfig (Path must be a string and component is required) - {"path":"/hello/world"}] - `); + [Error: Invalid routeConfig (Path must be a string and component is required) + {"path":"/hello/world"}] + `); }); test('route config with empty (but valid) path string', async () => { @@ -95,7 +96,7 @@ describe('loadRoutes', () => { component: 'hello/world.js', } as RouteConfig; - const result = await loadRoutes([routeConfig]); + const result = await loadRoutes([routeConfig], '/'); expect(result).toMatchSnapshot(); }); });