feat: 实现笔临 P0/P1 Electron 桌面应用 v0.1.0
交付写作核心(TipTap、自动保存、分卷分章)、Onboarding、7 主题与双语 i18n、快捷键设置;主进程使用 node:sqlite;补全 Vitest 与 Playwright E2E;统一 design/ 目录并移除 desigin 拼写错误路径。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { mkdtempSync, rmSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { GlobalSettingsService } from '../../src/main/services/global-settings'
|
||||
|
||||
let dir: string
|
||||
let svc: GlobalSettingsService
|
||||
|
||||
beforeEach(() => {
|
||||
dir = mkdtempSync(join(tmpdir(), 'bilin-settings-'))
|
||||
svc = new GlobalSettingsService(dir)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
rmSync(dir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
describe('GlobalSettingsService', () => {
|
||||
it('returns defaults when file missing', () => {
|
||||
const s = svc.get()
|
||||
expect(s.onboardingCompleted).toBe(false)
|
||||
expect(s.theme).toBe('default')
|
||||
expect(s.language).toBe('zh-CN')
|
||||
})
|
||||
|
||||
it('persists penName update', () => {
|
||||
svc.update({ penName: '山海' })
|
||||
const s2 = new GlobalSettingsService(dir)
|
||||
expect(s2.get().penName).toBe('山海')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user