Skip to content

Conversation

@fluffypony
Copy link

@fluffypony fluffypony commented Jun 24, 2025

Description

This PR introduces a complete test suite for the Tari Explorer, implementing over 40 test files covering all major components and routes. The test suite uses Vitest as the testing framework with supertest for HTTP endpoint testing, providing comprehensive coverage for the entire application.

Motivation and Context

The Tari Explorer previously had no test coverage, making it difficult to ensure code quality and prevent regressions. This test suite addresses that gap by providing:

  • Core Application Testing: Tests for main application setup, middleware, and configuration
  • Route Testing: Comprehensive coverage of all API endpoints including blocks, mempool, search, and export functionality
  • Utility Testing: Tests for caching, statistics, and updater components
  • Base Node Client Testing: Tests for gRPC client interactions with the Tari base node
  • Configuration Testing: Tests for cache settings and application configuration

How Has This Been Tested?

  • All tests pass with npm test
  • Coverage report shows 80%+ coverage across branches, functions, lines, and statements
  • Tests use proper mocking for external dependencies (gRPC client, file system operations)
  • HTTP endpoint testing validates request/response cycles
  • Integration tests verify component interactions

What process can a PR reviewer use to test or verify this change?

  1. Run npm install to install test dependencies (vitest, supertest, coverage tools)
  2. Run npm test to execute the complete test suite
  3. Run npm run test:coverage to generate coverage reports
  4. Review individual test files in __tests__/ and routes/__tests__/ directories
  5. Verify that all major application components have corresponding test coverage

Breaking Changes

  • None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants