Skip to content

Add testing framework and core tests #11

Description

@satsdisco

Summary

Zero tests exist. For a tool that handles private keys, signing, and publishing — this is a gap that needs filling before we add more features.

Scope (start small, grow)

Unit tests (Vitest)

  • lib/nostr.ts — event building, relay publishing, npub encoding
  • lib/markdown.ts — HTML↔Markdown conversion
  • lib/signer.ts — signing interface
  • types/nostr.ts — type validation

Integration tests

  • Auth flow: NIP-07, NIP-46 connection, nsec import
  • Publish flow: article event creation, relay selection, publish result handling
  • Draft persistence: save/restore from localStorage

Component tests (React Testing Library)

  • Editor: content input, draft auto-save
  • PublishModal: relay selection, publish trigger
  • ArticleReader: article rendering, comment loading

Setup

  • Vitest (already Vite-based, zero config needed)
  • React Testing Library for component tests
  • Mock nostr-tools relay connections

Acceptance Criteria

  • npm test runs and passes
  • Coverage on critical paths: signing, publishing, draft persistence
  • CI runs tests on PR (GitHub Actions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions