Skip to content

14 Testing and Verification

Vicky Patel edited this page Nov 18, 2026 · 1 revision

14. Testing & QA Verification Matrix

Unit Testing, Template Drift Prevention, Integration Suites, and CI Checks


๐Ÿงช Testing Philosophy

GitVerse operates under a strict Quality Assurance protocol:

  1. Deterministic Accuracy: Calculation algorithms must never hallucinate milestones or miscalculate tier progress.
  2. Zero-Drift Invariance: Static HTML pages must never drift out of sync from Go code models.
  3. Cross-Platform Compatibility: CLI binaries must pass tests on Linux, macOS, and Windows.
graph TD
    TestMatrix[GitVerse QA Matrix] --> GoTests[Go Test Suite: Unit & Integration]
    TestMatrix --> Drift[Zero-Drift Static Checks]
    TestMatrix --> JSTests[Node.js DOM Test Suite]
    TestMatrix --> Linters[golangci-lint & CodeQL]
Loading

๐Ÿ”ฌ Executing Test Suites

1. Run Complete Go Unit Test Suite

go test -v ./...

This executes tests across:

  • internal/engine: Validates threshold math, edge case boundaries, and progress percentages.
  • internal/catalog: Validates that all 15 achievements contain proper metadata, valid URLs, and non-decreasing thresholds.
  • internal/github: Tests HTML token parsing against fixture data without hitting live GitHub servers.
  • internal/webui: Asserts that HTML templates render without escaping errors or syntax breaks.

2. Verify Zero-Drift Static Pages

CI tests verify that static pages in site/ match the canonical Go templates:

go test -run TestGendocsDrift ./...

If you edited template content without running go run scripts/gendocs/main.go, this test will pinpoint the exact diff and fail early.

3. Run JavaScript & DOM Tests

To test browser DOM interactions (e.g. copy buttons, search input behaviors):

node --test web/web_test.js

๐Ÿ—ƒ๏ธ Test Fixtures & Mocking

Network calls to GitHub are mocked during unit tests using local HTML and JSON fixtures located in internal/github/testdata/:

  • profile_full.html: Sample user profile containing multiple unlocked tiers.
  • profile_empty.html: Brand new user with zero unlocked achievements.
  • achievement_modal_pull_shark.html: Raw modal fragment with multiple milestone dates.

This guarantees tests run offline, execute in milliseconds, and avoid rate limiting.

Clone this wiki locally