feat: ship v1.2.0 Wave 1 foundation with book settings, chapter management, and focus mode
Deliver schema v9, book/chapter IPC extensions, BookSettingsTab, chapter meta/tags, AI session menu, focus mode and TTS, template context enrich, and Wave 1 E2E coverage. 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 } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { openBookDb, closeAllBookDbs } from '../../src/main/db/connection'
|
||||
import { migrate } from '../../src/main/db/migrate'
|
||||
import { ChapterRepository } from '../../src/main/db/repositories/chapter.repo'
|
||||
import { ChapterTagRepository } from '../../src/main/db/repositories/chapter-tag.repo'
|
||||
import { VolumeRepository } from '../../src/main/db/repositories/volume.repo'
|
||||
|
||||
describe('ChapterTagRepository', () => {
|
||||
let dir: string
|
||||
|
||||
beforeEach(() => {
|
||||
dir = mkdtempSync(join(tmpdir(), 'bilin-tag-'))
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
closeAllBookDbs()
|
||||
rmSync(dir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
it('IT-TAG-01: set and list chapter tags', () => {
|
||||
const db = openBookDb(join(dir, 'test.sqlite'))
|
||||
migrate(db)
|
||||
const volId = new VolumeRepository(db).create('第一卷', 0).id
|
||||
const chId = new ChapterRepository(db).create(volId, '第一章', 0).id
|
||||
const tags = new ChapterTagRepository(db)
|
||||
tags.set(chId, '高潮', '#ff0000')
|
||||
tags.set(chId, '女主主场')
|
||||
expect(tags.list(chId)).toHaveLength(2)
|
||||
tags.remove(chId, '高潮')
|
||||
expect(tags.list(chId)).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user