fix(v032): NoteRepository.create now param + time-dep test flake fix
- create(input, now?: Date) signature 추가 (기존 setStatus/updateRawText 패턴 정합) - NoteRevisions.test.ts 4 testcase v1 capture 시간 명시 주입 (2026-05-09T00:00:00Z) - upsertFromSync.test.ts 2 testcase v1 capture 시간 명시 주입 - 시스템 시계가 2026-05-10T00:00:00Z 초과 시 DESC ordering 깨지던 회귀 회복 backlog: time-dependent flake (Cut F audit 발견) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -310,6 +310,24 @@ describe('NoteRepository', () => {
|
||||
const job = db.prepare('SELECT * FROM pending_jobs WHERE note_id=?').get(id);
|
||||
expect(job).toBeDefined();
|
||||
});
|
||||
|
||||
it('create accepts explicit now param', () => {
|
||||
const fixed = new Date('2026-05-09T10:00:00.000Z');
|
||||
const { id } = repo.create({ rawText: 'hello' }, fixed);
|
||||
const note = repo.findById(id)!;
|
||||
expect(note.createdAt).toBe('2026-05-09T10:00:00.000Z');
|
||||
expect(note.updatedAt).toBe('2026-05-09T10:00:00.000Z');
|
||||
});
|
||||
|
||||
it('create defaults now to new Date when omitted', () => {
|
||||
const before = Date.now();
|
||||
const { id } = repo.create({ rawText: 'hello' });
|
||||
const after = Date.now();
|
||||
const note = repo.findById(id)!;
|
||||
const ts = new Date(note.createdAt).getTime();
|
||||
expect(ts).toBeGreaterThanOrEqual(before);
|
||||
expect(ts).toBeLessThanOrEqual(after);
|
||||
});
|
||||
});
|
||||
|
||||
describe('NoteRepository.trash', () => {
|
||||
|
||||
Reference in New Issue
Block a user