serviceCli.test.ts 964 B

123456789101112131415161718192021222324
  1. import { homedir } from 'node:os'
  2. import { join } from 'node:path'
  3. import { describe, expect, it } from 'vitest'
  4. import { launchAgentPlist } from '../bin/hermes-yaoyao.mjs'
  5. describe('hermes-yaoyao LaunchAgent plist', () => {
  6. it('includes the local Hermes CLI directory in PATH', () => {
  7. const plist = launchAgentPlist()
  8. expect(plist).toContain(`${join(homedir(), '.local', 'bin')}:`)
  9. })
  10. it('enables Dashboard supervision by default', () => {
  11. expect(launchAgentPlist()).toContain('<key>HERMES_YAOYAO_SUPERVISE_DASHBOARD</key>')
  12. })
  13. it('can point the managed service at the stable current release link', () => {
  14. const root = join(homedir(), '.local', 'share', 'hermes-yaoyao', 'current')
  15. const plist = launchAgentPlist({ serviceRoot: root })
  16. expect(plist).toContain(`<string>${join(root, 'dist-server', 'server', 'index.js')}</string>`)
  17. expect(plist).toContain(`<key>WorkingDirectory</key><string>${root}</string>`)
  18. })
  19. })