Large images no longer store a text stub, so paste writes a real PNG; drag stays alive until drop instead of losing the session when the picker hides.
3.1 KiB
3.1 KiB
Testing
maCopy has an automated suite. There is no separate “live” Storybook/UI docs site yet — product behavior is documented in README / ROADMAP, and verified by tests.
Commands
| Command | What it runs |
|---|---|
npm test |
Frontend (Vitest + Testing Library, jsdom — CI default) |
npm run test:ui |
Same tests in the Vitest UI (open in your browser) |
npm run test:headed |
Unit tests in Chromium — still mostly a flash (DOM mount/unmount) |
npm run test:visual |
Watchable headed Playwright walkthrough of the real UI (visual.html) |
npm run test:watch |
Frontend in watch mode |
npm run test:rust |
Rust unit tests (cargo test) |
npm run test:all |
Frontend + Rust |
npm run lint |
TypeScript tsc --noEmit |
npm run check |
Lint + all tests (CI-style gate) |
Current counts (approx.): ~82 frontend + ~78 Rust unit tests.
What is covered
Frontend (src/**/*.test.tsx, transforms.test.ts)
- App: load entries, paste invoke, delete via keyboard, search invoke + clear on search failure
- ClipboardList: selection, multi-select modifiers, click vs drag, image stubs/thumbs, Alt=plain paste
- ContextMenu: Paste / Paste plain / transforms / Pin / Delete
- SettingsPanel: toggles (Downloads ingest), history limit, hotkey recorder, Launch at login → autostart enable
- SearchBar basics + Settings gear
- Transforms: plain text strip, JSON pretty, collapse / oneline
Tauri APIs are mocked in src/test/setup.ts (invoke, window, events, clipboard, autostart).
Backend (src-tauri/src/** #[cfg(test)])
- SQLite CRUD, FTS5 (incl.
/path/github.compunctuation), trim + pin preservation, settings - List previews: truncate text, omit image blobs, return thumbnails (legacy
[image WxH]stub rows still preview via thumbnail; paste resolves to a PNG) - Search excludes image rows (text-only FTS); App clears the list if search IPC fails
- Sensitive redaction (card / password / banking) while
get_entrystays full - Hotkey parser (`cmd+`` etc.)
- Image thumbnail / PNG helpers +
fit_rgba_under_bytesagainst productionMAX_IMAGE_BYTES - Oversized / Retina screenshot prepare — never skip; downscale + thumb + DB list preview
- Clipboard content hashing fingerprints
- Downloads ingest — skip incomplete names, PNG vs file insert, hash-dedup
- Drag-out materialize — existing file path, image → temp PNG, text → temp txt, preview placeholder
What is not covered (yet)
- End-to-end UI on a real Mac (no Playwright against the Tauri window)
- Live pasteboard polling (requires macOS Accessibility / real
NSPasteboard) - Accessibility permission / AppleScript paste in CI
- Notarized release smoke tests
- Performance benchmarks in CI
- Prefer-image-when-text-also-present (poller text-wins path)
- Exclude-apps / pause-monitoring integration
Recommended workflow
npm run check # before every PR / commit
npm run tauri dev # manual smoke: hotkey, paste, redaction, thumbs, drag-out, Downloads ingest
npm run tauri build # release .app when testing Login Items / signing