mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-15 04:18:20 +00:00
test(cli): assert structured upgrade failures
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
8444313fdf
commit
35f93b3e44
1 changed files with 6 additions and 4 deletions
|
|
@ -169,8 +169,9 @@ describe('upgrade command', () => {
|
|||
})
|
||||
await writeFile(join(rootDir, 'late-edit', 'SKILL.md'), '# edited after planning')
|
||||
|
||||
await expect(executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry }))
|
||||
.rejects.toThrow('local changes detected after upgrade planning')
|
||||
const result = await executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry })
|
||||
expect(result.items[0]).toMatchObject({ action: 'failed' })
|
||||
expect(result.items[0]?.reason).toContain('local changes detected after upgrade planning')
|
||||
expect(await readFile(join(rootDir, 'late-edit', 'SKILL.md'), 'utf-8'))
|
||||
.toBe('# edited after planning')
|
||||
const inventory = JSON.parse(await readFile(join(env.home, '.skillhub', 'inventory.json'), 'utf-8'))
|
||||
|
|
@ -211,8 +212,9 @@ describe('upgrade command', () => {
|
|||
const skillDir = join(rootDir, 'removed-late')
|
||||
await rm(skillDir, { recursive: true })
|
||||
|
||||
await expect(executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry }))
|
||||
.rejects.toThrow('installed target disappeared before upgrade commit')
|
||||
const result = await executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry })
|
||||
expect(result.items[0]).toMatchObject({ action: 'failed' })
|
||||
expect(result.items[0]?.reason).toContain('installed target disappeared before upgrade commit')
|
||||
expect(await exists(skillDir)).toBe(false)
|
||||
const inventory = JSON.parse(await readFile(join(env.home, '.skillhub', 'inventory.json'), 'utf-8'))
|
||||
expect(inventory.items[0]).toMatchObject({ version: '1.0.0', fingerprint: 'fp-v1' })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue