feat(v0210): NoteRepository.create 가 capture revision 을 함께 INSERT
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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' });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user