feat: ship v0.4.0 with interactive writing mode
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
||||
import { DatabaseSync } from 'node:sqlite'
|
||||
import { migrate } from '../../src/main/db/migrate'
|
||||
import { ChapterRepository } from '../../src/main/db/repositories/chapter.repo'
|
||||
import { VolumeRepository } from '../../src/main/db/repositories/volume.repo'
|
||||
import { OutlineRepository } from '../../src/main/db/repositories/outline.repo'
|
||||
import { checkInteractiveGate } from '../../src/main/services/interactive-gate.service'
|
||||
import type { SqliteDb } from '../../src/main/db/types'
|
||||
|
||||
describe('checkInteractiveGate', () => {
|
||||
let db: SqliteDb
|
||||
|
||||
beforeEach(() => {
|
||||
db = new DatabaseSync(':memory:')
|
||||
migrate(db)
|
||||
})
|
||||
|
||||
afterEach(() => db.close())
|
||||
|
||||
it('IT-INT-05: rejects empty book', () => {
|
||||
expect(checkInteractiveGate(db).eligible).toBe(false)
|
||||
})
|
||||
|
||||
it('IT-INT-05: accepts book with chapter content', () => {
|
||||
const volId = new VolumeRepository(db).create('卷一', 0).id
|
||||
new ChapterRepository(db).create(volId, '第一章', 0, '<p>有正文</p>')
|
||||
expect(checkInteractiveGate(db).eligible).toBe(true)
|
||||
})
|
||||
|
||||
it('IT-INT-05: accepts book with outline only', () => {
|
||||
new OutlineRepository(db).create(null, '节点', 0)
|
||||
expect(checkInteractiveGate(db).eligible).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user