Files
claude-code/src/commands/agents-platform/__tests__/index.test.ts
claude-code-best 2437040b5b feat: 添加云端管理命令(memory-stores、vault、schedule、skill-store、agents-platform)
- /memory-stores: 远程记忆存储管理
- /vault: 密钥保险库管理
- /schedule: 云端定时触发器管理(cron)
- /skill-store: 技能商店浏览和安装
- /agents-platform: 远程 agent 调度管理

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
2026-05-09 23:04:17 +08:00

67 lines
1.8 KiB
TypeScript

/**
* Tests for agents-platform/index.ts — command metadata only.
* We verify load() resolves without error but do NOT mock launchAgentsPlatform,
* to avoid polluting other test files via Bun's process-level mock.module cache.
*/
import { beforeAll, describe, expect, mock, test } from 'bun:test'
mock.module('bun:bundle', () => ({
feature: (_name: string) => true,
}))
let cmd: {
load?: () => Promise<{ call: unknown }>
isEnabled?: () => boolean
name?: string
type?: string
aliases?: string[]
bridgeSafe?: boolean
availability?: string[]
}
beforeAll(async () => {
const mod = await import('../index.js')
cmd = mod.default as typeof cmd
})
describe('agentsPlatform index metadata', () => {
test('command name is agents-platform', () => {
expect(cmd.name).toBe('agents-platform')
})
test('command type is local-jsx', () => {
expect(cmd.type).toBe('local-jsx')
})
test('isEnabled returns true', () => {
expect(cmd.isEnabled?.()).toBe(true)
})
test('aliases includes agents and schedule-agent', () => {
expect(cmd.aliases).toContain('agents')
expect(cmd.aliases).toContain('schedule-agent')
})
test('bridgeSafe is false', () => {
expect(cmd.bridgeSafe).toBe(false)
})
test('availability includes claude-ai', () => {
expect(cmd.availability).toContain('claude-ai')
})
test('load() exists and is a function', () => {
expect(typeof cmd.load).toBe('function')
})
test('load() resolves to object with call function', async () => {
const loaded = await cmd.load!()
expect(typeof (loaded as { call?: unknown }).call).toBe('function')
})
test('isHidden is boolean (dynamic: false when ANTHROPIC_API_KEY set, true when absent)', () => {
// isHidden = !process.env['ANTHROPIC_API_KEY']
expect(typeof (cmd as { isHidden?: unknown }).isHidden).toBe('boolean')
})
})