HbarSuite Docs
  • Welcome to HbarSuite
  • HbarSuite Developer Documentation
    • HbarSuite Smart Engine Applications
      • @hsuite/cross-chain-exchange
      • @hsuite/dao
        • DAO Application Testing
      • @hsuite/exchange
      • @hsuite/launchpad
      • @hsuite/multisig
      • @hsuite/nft-exchange
      • HSuite Smart App - Enterprise Hedera Application Framework
    • HSuite Libraries
      • @hsuite/api-key - Enterprise API Key Authentication System
      • @hsuite/auth-types
      • @hsuite/auth - Authentication Module
      • @hsuite/client-types
      • @hsuite/client - Client Service Module
      • @hsuite/dkg-types - Distributed Key Generation Type Definitions
      • @hsuite/hashgraph-types - Hedera Hashgraph Type Definitions
      • @hsuite/health - Comprehensive System Health Monitoring
      • @hsuite/helpers - Utility Library
      • @hsuite/ipfs - InterPlanetary File System Integration
      • @hsuite/shared-types - Shared Type Definitions
      • @hsuite/smart-config - Configuration Management
      • @hsuite/smart-ledgers - Multi-Ledger Management
      • @hsuite/smart-network-types - Smart Network Type Definitions
      • @hsuite/smart-transaction-types - Smart Transaction Type Definitions
      • @hsuite/smartnode-sdk - SmartNode Software Development Kit
      • @hsuite/snapshots - Multi-Ledger Token Snapshot Management
      • @hsuite/subscriptions-types - Subscription Management Type Definitions
      • @hsuite/subscriptions - Enterprise Subscription Management System
      • @hsuite/throttler-types - Rate Limiting Type Definitions
      • @hsuite/throttler - Advanced Rate Limiting for NestJS
      • @hsuite/users-types - User Type Definitions
      • @hsuite/users - User Management Module
      • @hsuite/validators-types
  • General Documentation
    • Smart Apps and Interaction
      • Subscription-Based Model
      • Token-Gate Model
    • The Smart Node Network
      • security-layer
      • Type of Validators Explained
      • Understanding Validators in Our System
      • Automating Responses to Network Changes & Key Rotation
      • Ensuring Continuous Operation and Recovery
      • Generating and Sharing Keys Collaboratively
      • Handling Node Expulsion and Replacement
      • Managing Cluster Membership
      • Protecting Secrets with Shamir's Method
      • Security Layer Integration
      • Setting Up Secure Clusters
    • Tokenomics
      • Tokenomics v1
      • Tokenomics V2
    • What is a Smart Node?
  • Restful APIs Documentation
Powered by GitBook
On this page
  • Testing Strategy
  • Unit Tests
  • E2E Tests
  • Coverage Exclusions
  • Running Tests
  1. HbarSuite Developer Documentation
  2. HbarSuite Smart Engine Applications
  3. @hsuite/dao

DAO Application Testing

Testing Strategy

Unit Tests

Unit tests are located in the src directory alongside the source files they test, with the naming convention *.spec.ts.

E2E Tests

End-to-end tests are located in the test directory with the naming convention *.e2e-spec.ts.

Coverage Exclusions

The following files are excluded from coverage calculations:

  • main.ts: The application bootstrap file is excluded from unit test coverage requirements because:

    1. It primarily contains integration code that initializes the application

    2. It has side effects (starting servers, etc.) that make it difficult to unit test

    3. It is implicitly tested through E2E tests

    4. Testing it would require extensive mocking of external dependencies

This decision was made to focus testing efforts on the business logic and components of the application rather than the bootstrap process.

Running Tests

To run tests for the DAO application:

# Run unit tests
npm test -- apps/dao

# Run unit tests with coverage
npm test -- apps/dao --coverage

# Run unit tests with coverage excluding main.ts
npm test -- apps/dao --coverage --collectCoverageFrom='apps/dao/src/**/*.ts' --collectCoverageFrom='!apps/dao/src/main.ts' --coverageDirectory='coverage/apps/dao'

# Run E2E tests
npm run test:e2e -- apps/dao
Previous@hsuite/daoNext@hsuite/exchange

Last updated 3 days ago