> ## Documentation Index
> Fetch the complete documentation index at: https://core.anylayer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing Smart Contracts

> Testing examples for ZKScore smart contracts

## Overview

Comprehensive testing examples for all ZKScore smart contracts using Hardhat and best practices.

## Testing Suite

<CodeGroup>
  ```javascript JavaScript theme={null}
  const { expect } = require('chai');
  const { ethers } = require('hardhat');

  describe('ZKScore Contract Suite', function() {
    let identitySBT, scoreCalculator, achievementRegistry;
    let owner, user1, user2;
    
    beforeEach(async function() {
      [owner, user1, user2] = await ethers.getSigners();
      
      // Deploy contracts
      const IdentitySBT = await ethers.getContractFactory('IdentitySBT');
      identitySBT = await IdentitySBT.deploy();
      
      const ScoreCalculator = await ethers.getContractFactory('ScoreCalculator');
      scoreCalculator = await ScoreCalculator.deploy();
      
      const AchievementRegistry = await ethers.getContractFactory('AchievementRegistry');
      achievementRegistry = await AchievementRegistry.deploy();
    });
    
    it('Should mint and activate identity', async function() {
      await identitySBT.mint(user1.address, 'alice.zks', 'metadata');
      await identitySBT.connect(user1).activate(1);
      
      expect(await identitySBT.isActivated(1)).to.equal(true);
    });
    
    it('Should calculate score', async function() {
      await scoreCalculator.calculateScore(user1.address);
      const score = await scoreCalculator.getScore(user1.address);
      
      expect(score).to.be.gte(0);
    });
  });
  ```
</CodeGroup>

## Best Practices

1. **Comprehensive Coverage**: Test all contract functions
2. **Edge Cases**: Test boundary conditions
3. **Gas Optimization**: Monitor gas usage
4. **Integration Tests**: Test contract interactions

## Related Documentation

* [Complete Integration](/contracts/examples/complete-integration)
* [Identity SBT](/contracts/identity-sbt/overview)
