feat(w5): ship v2.0.0 platform sync, undo persistence, and updates
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { mkdtempSync, rmSync, existsSync, readFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { LogService } from '../../src/main/services/log.service'
|
||||
|
||||
describe('LogService', () => {
|
||||
let dir: string
|
||||
let logs: LogService
|
||||
|
||||
beforeEach(() => {
|
||||
dir = mkdtempSync(join(tmpdir(), 'bilin-log-'))
|
||||
logs = new LogService(dir)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
rmSync(dir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
it('UT-LOG-01: manual error writes to log file', () => {
|
||||
logs.logManualError('UT-LOG-01 test error')
|
||||
const logFile = join(dir, 'logs', 'bilin.log')
|
||||
expect(existsSync(logFile)).toBe(true)
|
||||
const content = readFileSync(logFile, 'utf-8')
|
||||
expect(content).toContain('UT-LOG-01 test error')
|
||||
})
|
||||
|
||||
it('detects crash flag from previous run', () => {
|
||||
logs.markUncleanExit()
|
||||
const next = new LogService(dir)
|
||||
expect(next.hadCrashOnLastRun()).toBe(true)
|
||||
next.clearCrashFlag()
|
||||
expect(next.hadCrashOnLastRun()).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user