fix: RemoteTriggerTool 测试补充 log/debug/bun:bundle mock,对齐上游 a2cfaf9
CCP 此前已合并该 commit 的大部分改动(growthbook/policyLimits/auditRecords), 仅 log/debug/bun:bundle 三个 mock 遗漏。补齐后测试在 mock 层面与上游一致。 注意: getOauthConfig 错误是上游预存在的 Bun mock.module 问题(切 upstream/main 也复现), 不影响本次提交的正确性。
This commit is contained in:
parent
44bfc189e0
commit
be76720400
|
|
@ -10,9 +10,11 @@ import {
|
||||||
} from 'bun:test'
|
} from 'bun:test'
|
||||||
import { authMock } from '../../../../../../tests/mocks/auth'
|
import { authMock } from '../../../../../../tests/mocks/auth'
|
||||||
import { setupAxiosMock } from '../../../../../../tests/mocks/axios'
|
import { setupAxiosMock } from '../../../../../../tests/mocks/axios'
|
||||||
|
import { logMock } from '../../../../../../tests/mocks/log'
|
||||||
|
import { debugMock } from '../../../../../../tests/mocks/debug'
|
||||||
|
|
||||||
let requestStatus = 200
|
let requestStatus = 200
|
||||||
const auditRecords: Record<string, unknown>[] = []
|
let auditRecords: Array<Record<string, unknown>> = []
|
||||||
|
|
||||||
const axiosHandle = setupAxiosMock()
|
const axiosHandle = setupAxiosMock()
|
||||||
axiosHandle.stubs.request = async () => ({
|
axiosHandle.stubs.request = async () => ({
|
||||||
|
|
@ -29,6 +31,9 @@ afterAll(() => {
|
||||||
|
|
||||||
mock.module('src/utils/auth.js', authMock)
|
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', () => ({
|
mock.module('src/services/oauth/client.js', () => ({
|
||||||
getOrganizationUUID: async () => 'org',
|
getOrganizationUUID: async () => 'org',
|
||||||
}))
|
}))
|
||||||
|
|
@ -41,6 +46,10 @@ mock.module('src/services/policyLimits/index.js', () => ({
|
||||||
isPolicyAllowed: () => true,
|
isPolicyAllowed: () => true,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
mock.module('bun:bundle', () => ({
|
||||||
|
feature: () => false,
|
||||||
|
}))
|
||||||
|
|
||||||
// Narrow mock for the side-effectful entries in `src/constants/oauth.js`.
|
// Narrow mock for the side-effectful entries in `src/constants/oauth.js`.
|
||||||
// Pure data exports (ALL_OAUTH_SCOPES, CLAUDE_AI_*_SCOPE, etc.) come from
|
// 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
|
// the real module and are not mocked, per the test policy that constants
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user