mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-04 02:21:47 +00:00
27 lines
766 B
TypeScript
27 lines
766 B
TypeScript
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
|
|
import { writeActiveSessionFile } from '../app/useSessionLifecycle.js'
|
|
|
|
describe('writeActiveSessionFile', () => {
|
|
let dir = ''
|
|
|
|
afterEach(() => {
|
|
if (dir) {
|
|
rmSync(dir, { force: true, recursive: true })
|
|
dir = ''
|
|
}
|
|
})
|
|
|
|
it('writes the actual resumed session id for the shell exit summary', () => {
|
|
dir = mkdtempSync(join(tmpdir(), 'hermes-tui-active-'))
|
|
const path = join(dir, 'active.json')
|
|
|
|
writeActiveSessionFile('actual_session', path)
|
|
|
|
expect(JSON.parse(readFileSync(path, 'utf8'))).toEqual({ session_id: 'actual_session' })
|
|
})
|
|
})
|