fix(v026): #12 trashCount cap → countTrashed() 정확 N (silent undercount 해소)

기존 UI 가 listTrash 200 limit 후 length 사용 → 350개 trash 시 dialog
"200개 영구 삭제" 표시되지만 실제 350 모두 삭제. 사용자 혼동 해소.

- NoteRepository.countTrashed() 신규 — SELECT COUNT(*) WHERE deleted_at IS NOT NULL
- IPC inbox:trashCount → countTrashed 사용
- 단위 +2 cases (>200 not capped, empty 0)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-05 01:18:10 +09:00
parent df27a9637e
commit e2c53a28dc

View File

@@ -492,6 +492,19 @@ describe('NoteRepository.countTrashed', () => {
expect(repo.countTrashed()).toBe(10);
expect(repo.listTrashed({ limit: 5 })).toHaveLength(5);
});
it('countTrashed returns accurate count (>200 not capped)', () => {
const now = new Date().toISOString();
for (let i = 0; i < 250; i++) {
const id = repo.create({ rawText: `n${i}` }).id;
repo.trash(id, now);
}
expect(repo.countTrashed()).toBe(250);
});
it('countTrashed returns 0 for empty trash', () => {
expect(repo.countTrashed()).toBe(0);
});
});
describe('Active queries exclude deleted notes', () => {