feat(v0211): rebuildFtsTagsForNote 헬퍼 + tags 변경 path 통합 (single write)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1074,3 +1074,33 @@ describe('NoteRepository — note_revisions', () => {
|
||||
expect(rows[0]).toEqual({ raw_text: 'hello', edited_by: 'capture' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('NoteRepository — notes_fts tags sync (v0.2.11 Cut D)', () => {
|
||||
let db: Database.Database;
|
||||
|
||||
beforeEach(() => {
|
||||
db = new Database(':memory:');
|
||||
runMigrations(db);
|
||||
});
|
||||
|
||||
it('updateAiResult 후 notes_fts.tags 가 csv 로 sync', () => {
|
||||
const repo = new NoteRepository(db);
|
||||
const { id } = repo.create({ rawText: '회의 본문' });
|
||||
repo.updateAiResult(id, { title: '제목', summary: '요약', tags: ['기획', '회의'], provider: 'p' });
|
||||
const row = db
|
||||
.prepare(`SELECT tags FROM notes_fts WHERE note_id=?`)
|
||||
.get(id) as { tags: string };
|
||||
expect(row.tags.split(' ').sort()).toEqual(['기획', '회의']);
|
||||
});
|
||||
|
||||
it('updateUserAiFields tags 갱신 후 notes_fts.tags 동기', () => {
|
||||
const repo = new NoteRepository(db);
|
||||
const { id } = repo.create({ rawText: '본문' });
|
||||
repo.updateAiResult(id, { title: 't', summary: 's', tags: ['old'], provider: 'p' });
|
||||
repo.updateUserAiFields(id, { tags: ['new1', 'new2'] });
|
||||
const row = db
|
||||
.prepare(`SELECT tags FROM notes_fts WHERE note_id=?`)
|
||||
.get(id) as { tags: string };
|
||||
expect(row.tags.split(' ').sort()).toEqual(['new1', 'new2']);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user