mirror of
https://github.com/iflytek/skillhub.git
synced 2026-08-28 11:25:00 +00:00
- Add integration tests for doctor, install, list, publish, remove, whoami commands - Expand fake-registry with resolve/delete state capture for real assertions - Fix update command: use correct package name @astron-team/skillhub from constants - Refactor runUpdateCommand to accept string[] instead of fragile string splitting - Add dependency injection to updateCommand for testable unit tests without global mocks - Replace package.json import with codegen (scripts/generate-pkg-info.ts) to avoid leaking devDependencies into the build artifact - Fix startNetworkFailureServer TOCTOU race by keeping listener alive - Add TODO markers for known help command bugs (--json not forwarded, unknown topic crash) - Extend update integration test timeout for real npm registry checks
26 lines
928 B
TypeScript
26 lines
928 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import { runUpdateCommand } from '../../../src/platform/updater'
|
|
|
|
describe('runUpdateCommand', () => {
|
|
test('succeeds with node --version', async () => {
|
|
const result = await runUpdateCommand(['node', '--version'])
|
|
expect(result.success).toBe(true)
|
|
expect(result.output).toMatch(/v\d+\.\d+/)
|
|
})
|
|
|
|
test('fails on invalid node flag', async () => {
|
|
const result = await runUpdateCommand(['node', '--invalid-flag-xyz-12345'])
|
|
expect(result.success).toBe(false)
|
|
})
|
|
|
|
test('returns failure for empty command', async () => {
|
|
const result = await runUpdateCommand([])
|
|
expect(result.success).toBe(false)
|
|
expect(result.output).toBe('empty update command')
|
|
})
|
|
|
|
test('handles spawn error for missing binary', async () => {
|
|
const result = await runUpdateCommand(['nonexistent-binary-xyz-12345'])
|
|
expect(result.success).toBe(false)
|
|
})
|
|
})
|