From 6c985136f51870bf45842aceac7794e98c7ae0be Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Tue, 27 Feb 2024 00:31:50 +0800 Subject: [PATCH] test(next-drupal): fix bug in jsonRpc test util and rename utils files --- packages/next-drupal/tests/utils/mocks/index.ts | 4 ++-- .../tests/utils/mocks/{logger.ts => mockLogger.ts} | 0 .../tests/utils/mocks/{fetch.ts => spyOnFetch.ts} | 0 packages/next-drupal/tests/utils/rpc.ts | 6 +++--- 4 files changed, 5 insertions(+), 5 deletions(-) rename packages/next-drupal/tests/utils/mocks/{logger.ts => mockLogger.ts} (100%) rename packages/next-drupal/tests/utils/mocks/{fetch.ts => spyOnFetch.ts} (100%) diff --git a/packages/next-drupal/tests/utils/mocks/index.ts b/packages/next-drupal/tests/utils/mocks/index.ts index 96ddd33a..970d69af 100644 --- a/packages/next-drupal/tests/utils/mocks/index.ts +++ b/packages/next-drupal/tests/utils/mocks/index.ts @@ -1,3 +1,3 @@ export * from "./data" -export * from "./fetch" -export * from "./logger" +export * from "./spyOnFetch" +export * from "./mockLogger" diff --git a/packages/next-drupal/tests/utils/mocks/logger.ts b/packages/next-drupal/tests/utils/mocks/mockLogger.ts similarity index 100% rename from packages/next-drupal/tests/utils/mocks/logger.ts rename to packages/next-drupal/tests/utils/mocks/mockLogger.ts diff --git a/packages/next-drupal/tests/utils/mocks/fetch.ts b/packages/next-drupal/tests/utils/mocks/spyOnFetch.ts similarity index 100% rename from packages/next-drupal/tests/utils/mocks/fetch.ts rename to packages/next-drupal/tests/utils/mocks/spyOnFetch.ts diff --git a/packages/next-drupal/tests/utils/rpc.ts b/packages/next-drupal/tests/utils/rpc.ts index 7b3e4b7d..86533e8c 100644 --- a/packages/next-drupal/tests/utils/rpc.ts +++ b/packages/next-drupal/tests/utils/rpc.ts @@ -8,10 +8,10 @@ class JsonRpc extends NextDrupalBase { this.apiPrefix = "/jsonrpc" } - async execute(body) { - const endpoint = await jsonRpc.buildEndpoint() + async execute(body: object) { + const endpoint = await this.buildEndpoint() - const response = await jsonRpc.fetch(endpoint, { + const response = await this.fetch(endpoint, { method: "POST", body: JSON.stringify(body), withAuth: true,