Testing Guide

Testing & Security

AetherCycle was built with a security-first philosophy, backed by a comprehensive test suite of 600+ individual tests.

This suite is the primary tool for verifying correctness of the protocol and is essential for anyone contributing to the codebase.


Running the Full Suite

To execute the entire test suite:

# Runs all 600+ tests across all categories
npx hardhat test

Test Categories

The tests are organized into three categories for clarity and efficiency:

1. Unit Tests (/test/unit)

  • Focus: individual contracts in isolation.

  • Ensures each function behaves according to specification.

npx hardhat test test/unit/

2. Integration Tests (/test/integration)

  • Focus: interactions between multiple contracts.

  • Example: verifying that the PerpetualEngine distributes rewards correctly to AECStakingLP.sol.

  • Crucial for validating protocol-wide functionality.

npx hardhat test test/integration/

3. Edge Case Tests (/test/edge)

  • Focus: rare or malicious scenarios.

  • Stress-tests the system against:

    • Boundary conditions

    • Unexpected user behavior

    • Potential economic exploits

npx hardhat test test/edge/

Test Coverage

To measure coverage and ensure broad protection:

npx hardhat coverage

A high coverage score provides additional assurance of the protocol’s robustness and resilience.

Last updated