feat(w4): ship v1.5.0 timeline, character arc, and compliance

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-08 17:40:42 +08:00
parent c5c0b7329b
commit cb6b4c3731
51 changed files with 1528 additions and 42 deletions
+33
View File
@@ -0,0 +1,33 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
import { mkdtempSync, rmSync } from 'fs'
import { join } from 'path'
import { tmpdir } from 'os'
import { ComplianceService } from '../../src/main/services/compliance.service'
import { GlobalSettingsService } from '../../src/main/services/global-settings'
describe('ComplianceService', () => {
let dir: string
let svc: ComplianceService
beforeEach(() => {
dir = mkdtempSync(join(tmpdir(), 'bilin-compliance-'))
svc = new ComplianceService(new GlobalSettingsService(dir))
})
afterEach(() => {
rmSync(dir, { recursive: true, force: true })
})
it('UT-COMP-01: scans built-in and custom words', () => {
svc.setWords(['测试敏感词'])
const result = svc.scanText('正文含违禁与测试敏感词内容')
const words = result.matches.map((m) => m.word)
expect(words).toContain('违禁')
expect(words).toContain('测试敏感词')
})
it('UT-COMP-02: applyReplacements replaces configured pairs', () => {
const out = svc.applyReplacements('这里有违禁词', { : '***' })
expect(out).toBe('这里有***词')
})
})