mirror of
https://github.com/sotashimozono/obsidian-remote-ssh.git
synced 2026-07-22 06:52:07 +00:00
Mock fixes (false-positive vectors):
- addClass/removeClass widened to (...classes: string[])
- toggleClass widened to (string | string[], boolean)
- setText widened to (string | DocumentFragment) with proper branch
- createEl/createDiv/createSpan accept the optional callback Obsidian
patterns use; mock used to drop it silently
- simulate{Input,Change,Click} now throw if no callback was registered
— green-on-broken-wiring is the bug to avoid
- Native click event wired on buttonEl so query-and-click works
- New helpers: findButton, clickButton, getSettingFor, getSettingsIn,
AnyComponent discriminator (kind: 'text' | 'toggle' | 'button' | 'dropdown')
- Drop _obsidianMockPatched leak from global HTMLElement; use Symbol.for
Setup:
- vitest.setup.ts auto-clears the Notice buffer before each test so
individual files don't have to remember to do it
SettingsTab tests:
- fakePlugin typed via SettingsTabPlugin (Pick-style slice) so a new
required method on RemoteSshPlugin would surface as a compile error
- vi.mock isolates the real telemetry singleton from the toggle path
- Real interaction tests added: Connect/Disconnect clicks,
clientId text input drives sanitizeClientId, reconnect-attempts
in-range/out-of-range, telemetry toggle change, daemon Restart
success + failure paths
- displayTab(plugin) helper de-duplicates render boilerplate
- SettingsTab.ts coverage 33→53% lines, 27→60% branches
OnboardingModal tests:
- internals(modal) helper replaces six near-identical inline casts
- vi.waitFor replaces the fragile `await Promise.resolve()` x2 flush
- Browse-button empty-host guard test added
vitest.config: trim historical 78/70/72 numbers from threshold comment
Net: 18 → 26 tests; coverage 68.78/63.23/64.43 → 69.62/64.25/65.29.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| SettingsTab.test.ts | ||