feat(v0210): NoteRepository.create 가 capture revision 을 함께 INSERT

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-09 20:36:09 +09:00
parent 76c23457ee
commit 18deee5900
2 changed files with 24 additions and 0 deletions

View File

@@ -1054,3 +1054,23 @@ describe('NoteRepository.countByAiStatus', () => {
expect(repo.countByAiStatus('done')).toBe(0);
});
});
describe('NoteRepository — note_revisions', () => {
let db: Database.Database;
let repo: NoteRepository;
beforeEach(() => {
db = new Database(':memory:');
runMigrations(db);
repo = new NoteRepository(db);
});
it('create() 가 첫 revision (edited_by=capture) 을 INSERT 한다', () => {
const { id } = repo.create({ rawText: 'hello' });
const rows = db
.prepare(`SELECT raw_text, edited_by FROM note_revisions WHERE note_id=?`)
.all(id) as Array<{ raw_text: string; edited_by: string }>;
expect(rows).toHaveLength(1);
expect(rows[0]).toEqual({ raw_text: 'hello', edited_by: 'capture' });
});
});