From e2c53a28dca0478fbfc042e5c41560b0d6e26519 Mon Sep 17 00:00:00 2001 From: altair823 Date: Tue, 5 May 2026 01:18:10 +0900 Subject: [PATCH] =?UTF-8?q?fix(v026):=20#12=20trashCount=20cap=20=E2=86=92?= =?UTF-8?q?=20countTrashed()=20=EC=A0=95=ED=99=95=20N=20(silent=20undercou?= =?UTF-8?q?nt=20=ED=95=B4=EC=86=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존 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) --- tests/unit/NoteRepository.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unit/NoteRepository.test.ts b/tests/unit/NoteRepository.test.ts index 3d95c4c..37e6abb 100644 --- a/tests/unit/NoteRepository.test.ts +++ b/tests/unit/NoteRepository.test.ts @@ -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', () => {