From da1173921f5dde659671daaa8c5cd77882eeb57b Mon Sep 17 00:00:00 2001 From: Wolfgang Ziegler Date: Sat, 18 Jan 2025 22:54:21 -0600 Subject: [PATCH] fix: correct node preview route (#304) --- playground/pages/{ => node}/preview/[...slug].client.vue | 2 +- playground/server/routes/ce-api/{ => node}/preview/node.ts | 0 test/unit/components/preview.test.ts | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename playground/pages/{ => node}/preview/[...slug].client.vue (94%) rename playground/server/routes/ce-api/{ => node}/preview/node.ts (100%) diff --git a/playground/pages/preview/[...slug].client.vue b/playground/pages/node/preview/[...slug].client.vue similarity index 94% rename from playground/pages/preview/[...slug].client.vue rename to playground/pages/node/preview/[...slug].client.vue index 4ef795e..555fedc 100644 --- a/playground/pages/preview/[...slug].client.vue +++ b/playground/pages/node/preview/[...slug].client.vue @@ -7,7 +7,7 @@ // is done client-side and without API-proxy, such that the cookie is forwarded by // the browser. It requires the CORS helper module to be enabled. -import DefaultPage from '../[...slug].vue' +import DefaultPage from '../../[...slug].vue' export default { extends: DefaultPage, diff --git a/playground/server/routes/ce-api/preview/node.ts b/playground/server/routes/ce-api/node/preview/node.ts similarity index 100% rename from playground/server/routes/ce-api/preview/node.ts rename to playground/server/routes/ce-api/node/preview/node.ts diff --git a/test/unit/components/preview.test.ts b/test/unit/components/preview.test.ts index 8184d7e..10e1abb 100644 --- a/test/unit/components/preview.test.ts +++ b/test/unit/components/preview.test.ts @@ -4,7 +4,7 @@ import { mountSuspended, registerEndpoint } from '@nuxt/test-utils/runtime' import App from '~/app.vue' describe('Preview routes', () => { - registerEndpoint('http://127.0.0.1:3001/ce-api/preview/node', () => ({ + registerEndpoint('http://127.0.0.1:3001/ce-api/node/preview/node', () => ({ content: { element: 'node-article', body: '

Some example body.

' @@ -30,7 +30,7 @@ describe('Preview routes', () => { it('renders preview/node with direct backend request, skipping drupal-ce-proxy', async () => { const component = await mountSuspended(App, { - route: '/preview/node' + route: '/node/preview/node' }) expect(component.html()).toContain('

Some example body.

') })