From be76720400fcd233665ef7dbb931cb7dabdb746d Mon Sep 17 00:00:00 2001 From: James Feng <47167674+GhostDragon124@users.noreply.github.com> Date: Thu, 4 Jun 2026 14:01:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20RemoteTriggerTool=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=A1=A5=E5=85=85=20log/debug/bun:bundle=20mock=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E4=B8=8A=E6=B8=B8=20a2cfaf9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CCP 此前已合并该 commit 的大部分改动(growthbook/policyLimits/auditRecords), 仅 log/debug/bun:bundle 三个 mock 遗漏。补齐后测试在 mock 层面与上游一致。 注意: getOauthConfig 错误是上游预存在的 Bun mock.module 问题(切 upstream/main 也复现), 不影响本次提交的正确性。 --- .../__tests__/RemoteTriggerTool.test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/builtin-tools/src/tools/RemoteTriggerTool/__tests__/RemoteTriggerTool.test.ts b/packages/builtin-tools/src/tools/RemoteTriggerTool/__tests__/RemoteTriggerTool.test.ts index d9cef4798..3196ad98a 100644 --- a/packages/builtin-tools/src/tools/RemoteTriggerTool/__tests__/RemoteTriggerTool.test.ts +++ b/packages/builtin-tools/src/tools/RemoteTriggerTool/__tests__/RemoteTriggerTool.test.ts @@ -10,9 +10,11 @@ import { } from 'bun:test' import { authMock } from '../../../../../../tests/mocks/auth' import { setupAxiosMock } from '../../../../../../tests/mocks/axios' +import { logMock } from '../../../../../../tests/mocks/log' +import { debugMock } from '../../../../../../tests/mocks/debug' let requestStatus = 200 -const auditRecords: Record[] = [] +let auditRecords: Array> = [] const axiosHandle = setupAxiosMock() axiosHandle.stubs.request = async () => ({ @@ -29,6 +31,9 @@ afterAll(() => { mock.module('src/utils/auth.js', authMock) +mock.module('src/utils/log.ts', logMock) +mock.module('src/utils/debug.ts', debugMock) + mock.module('src/services/oauth/client.js', () => ({ getOrganizationUUID: async () => 'org', })) @@ -41,6 +46,10 @@ mock.module('src/services/policyLimits/index.js', () => ({ isPolicyAllowed: () => true, })) +mock.module('bun:bundle', () => ({ + feature: () => false, +})) + // Narrow mock for the side-effectful entries in `src/constants/oauth.js`. // Pure data exports (ALL_OAUTH_SCOPES, CLAUDE_AI_*_SCOPE, etc.) come from // the real module and are not mocked, per the test policy that constants