Skip to main content

Overview

Complete guide for testing ZKScore smart contracts using Hardhat testing framework.

Prerequisites

  • Hardhat: v2.17.0 or higher
  • Node.js: v16.0.0 or higher
  • Test Tokens: ETH for testing transactions

Setup

Installation

Configuration

Test Structure

Basic Test Setup

Identity SBT Tests

Minting Tests

Activation Tests

Score Calculator Tests

Score Calculation Tests

Achievement Registry Tests

Achievement Creation Tests

Integration Tests

End-to-End Tests

Running Tests

Test Commands

Test Coverage

Best Practices

  1. Comprehensive Testing: Test all functions and edge cases
  2. Event Testing: Verify events are emitted correctly
  3. Gas Testing: Monitor gas usage for optimization
  4. Integration Testing: Test complete user journeys
  5. Error Testing: Test all error conditions