Skip to content

test: cover desktop runtime detection #53

Description

@McanKul

Goal

Add deterministic unit coverage for isTauriRuntime() in src/lib/tauriEnv.ts, which separates desktop-only behavior from the browser preview.

Scope

  • Add src/lib/tauriEnv.test.ts.
  • Test the helper by installing and restoring controlled window markers.
  • Keep the tests independent of a running Tauri application.

Acceptance criteria

  • Returns false when window is unavailable.
  • Returns false when a browser-like window has no Tauri markers.
  • Returns true for each supported marker independently: __TAURI_INTERNALS__, __TAURI__ and isTauri.
  • Falsey marker values do not produce a false positive.
  • Every test restores global state so test order cannot affect the result.
  • Production behavior stays unchanged unless a test exposes a documented defect.

Verification

npm test -- src/lib/tauriEnv.test.ts
npm run typecheck

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedExtra attention is neededtestsTest coverage and test infrastructure

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions