Files
greenflame089 0b100af686 Release v0.2.2
2025-08-22 07:28:42 -04:00

2.6 KiB

Testing — Q-Blog

Local

# ensure Node 20.x is active (use nvm if needed)
npm run typecheck
npm run lint:phase0
npm run test:run
npm run build

MSW is enabled in tests; unhandled requests are bypassed.

CI (Gitea)

  • Workflow: .gitea/workflows/ci.yml
  • Runner: self-hosted
  • Steps: checkout → Node setup → deps → typecheck → lint (phase0) → format check → tests (Vitest + RTL + MSW) → build (Vite)

a11y smoke

tests/axe-smoke.test.tsx runs jest-axe.

Additional tests added:

  • tests/utils/blogIdformats.test.ts: blog id helpers.
  • tests/utils/extractTextFromSlate.test.ts: Slate plain-text extraction.
  • tests/utils/time.test.ts: relative time helpers.
  • tests/utils/toBase64.test.ts: binary encode/decode helpers.
  • tests/state/blogSlice.test.ts: reducer behaviors and upserts.
  • tests/hooks/useFetchPosts.test.tsx: minimal sanity for hook utilities.
  • tests/utils/checkStructure.test.ts: blog and mail structure validation.
  • tests/utils/fetchPosts.test.ts: maps BLOG_POST fetch via MSW.
  • tests/utils/qortalRequestFunctions.test.ts: qortalRequest wrappers behavior.
  • tests/utils/fetchMail.test.ts: mail decrypt/mapping flow with mocked qortalRequest.
  • tests/utils/wiki.test.ts: wiki authorization and canonical resolver.
  • tests/pages/BlogList.test.tsx: renders posts and new-post banner (MUI ThemeProvider).
  • tests/pages/BlogIndividualProfile.test.tsx: loads blog title from API (MSW + ThemeProvider).
  • tests/pages/BlogIndividualPost.wiki.test.tsx: canonical across Names + edit visibility.
  • tests/pages/BlogIndividualProfile.wiki.test.tsx: canonical grouping on blog page.
  • tests/utils/wikiSettingsCache.test.ts: cache fetch and settings mapping.
  • tests/hooks/useFetchPosts.favorites.wiki.test.tsx: Favorites canonicalization across Names.

Notes

  • MSW is configured in tests/setup.ts; unhandled requests are bypassed by default.
  • Coverage reporter is v8 (text, lcov). Consider adding thresholds as the suite expands.
  • Test env adds a minimal IntersectionObserver polyfill in tests/setup.ts for components using react-intersection-observer.
  • UI tests wrap components in MUI ThemeProvider with a default theme to satisfy styled theme usage.

Test Scenarios — Multi-Blog (future)

  • Header: 0 vs 1 vs N blogs; menu opens/closes; selection navigates and sets active blog.
  • Name root redirect: single blog → posts; else → /{{name}}/blogs; polite loading text in aria-live.
  • UserBlogs page: list/empty states; self vs public controls.
  • A11y smoke (axe) on header + UserBlogs (when available).