diff --git a/packages/next-drupal/src/client.ts b/packages/next-drupal/src/client.ts index 7e22df04..bd0cebe9 100644 --- a/packages/next-drupal/src/client.ts +++ b/packages/next-drupal/src/client.ts @@ -894,7 +894,7 @@ export class DrupalClient { async translatePath( path: string, options?: JsonApiWithAuthOptions - ): Promise { + ): Promise { options = { withAuth: this.withAuth, ...options, @@ -927,7 +927,7 @@ export class DrupalClient { options?: { pathPrefix?: PathPrefix } & JsonApiWithAuthOptions - ): Promise { + ): Promise { options = { pathPrefix: "/", ...options, diff --git a/packages/next-drupal/tests/client.test.ts b/packages/next-drupal/tests/client.test.ts index 9df7849a..aeacea93 100644 --- a/packages/next-drupal/tests/client.test.ts +++ b/packages/next-drupal/tests/client.test.ts @@ -1445,13 +1445,15 @@ describe("getResourceFromContext", () => { }, } - const recipe = await client.getResourceFromContext(path, context, { - params: { - "fields[node--recipe]": "title,path,status", - }, - }) + if (path) { + const recipe = await client.getResourceFromContext(path, context, { + params: { + "fields[node--recipe]": "title,path,status", + }, + }) - await expect(recipe).toMatchSnapshot() + await expect(recipe).toMatchSnapshot() + } }) })