mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
27 lines
735 B
TypeScript
27 lines
735 B
TypeScript
import { describe, it } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { performCliSelfUpdate } from './update-checker'
|
|
|
|
describe('performCliSelfUpdate', () => {
|
|
it('installs the latest chatlab-cli package globally', async () => {
|
|
const calls: Array<{ command: string; args: string[] }> = []
|
|
|
|
const result = await performCliSelfUpdate({
|
|
runCommand: async (command, args) => {
|
|
calls.push({ command, args })
|
|
return { success: true }
|
|
},
|
|
write: () => {},
|
|
platform: 'darwin',
|
|
})
|
|
|
|
assert.deepEqual(calls, [
|
|
{
|
|
command: 'npm',
|
|
args: ['install', '-g', 'chatlab-cli@latest'],
|
|
},
|
|
])
|
|
assert.deepEqual(result, { success: true })
|
|
})
|
|
})
|