import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { mkdtempSync, rmSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; import { update, maybeNotifyUpdate } from '../src/cli/commands/update.js'; describe('update', () => { let dir: string; beforeEach(() => { dir = mkdtempSync(join(tmpdir(), 'ah-upd-')); }); afterEach(() => { rmSync(dir, { recursive: true, force: true }); }); it('points at the package manager when the install is not a git checkout', async () => { const logs: string[] = []; const original = console.log; console.log = (msg: string) => logs.push(msg); await update(dir); console.log = original; expect(logs.some((m) => m.includes('package manager'))).toBe(true); }); it('maybeNotifyUpdate is a silent no-op outside a git checkout', () => { expect(() => maybeNotifyUpdate(dir)).not.toThrow(); }); });