feat(trash): telemetry 4 new kinds (trash/restore/permanent_delete/empty_trash) (#4 v0.2.3)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-01 21:05:06 +09:00
parent 78c10e8817
commit 284bfcbdd1
4 changed files with 82 additions and 4 deletions

View File

@@ -146,7 +146,7 @@ describe('TelemetryService.readAllRecent', () => {
const svc = new TelemetryService(dir, () => new Date('2026-05-01T12:00:00Z'), 14);
const events = await svc.readAllRecent();
expect(events).toHaveLength(3);
expect(events.map((e) => e.payload.noteId)).toEqual(['a', 'b', 'b']);
expect(events.map((e) => (e.payload as { noteId: string }).noteId)).toEqual(['a', 'b', 'b']);
});
it('skips malformed lines (silent — invariant)', async () => {
@@ -157,7 +157,7 @@ describe('TelemetryService.readAllRecent', () => {
const svc = new TelemetryService(dir, () => new Date('2026-05-01T12:00:00Z'), 14);
const events = await svc.readAllRecent();
expect(events).toHaveLength(1);
expect(events[0]!.payload.noteId).toBe('a');
expect((events[0]!.payload as { noteId: string }).noteId).toBe('a');
});
it('returns [] when dir missing', async () => {