Skip to content

Write integration tests for reward calculation endpoints #6

@AbdulSnk

Description

@AbdulSnk

Overview

The StreamForge API needs integration tests to ensure reward calculation endpoints behave correctly end-to-end before any payout logic is triggered on the Stellar blockchain.

What needs to be done

  • Set up a testing environment using NestJS testing utilities
  • Write integration tests for the following scenarios:
    • Valid contributor with calculated rewards returns correct payout amount
    • Contributor with zero score returns zero reward
    • Missing or invalid contributor ID returns proper error
    • Unauthorized request returns 401
  • Place all test files under the existing test/ directory
  • Use supertest for HTTP-level integration testing

Acceptance Criteria

  • At least 4 integration tests covering the scenarios above
  • Tests live under test/ directory
  • All tests pass with npm run test:e2e
  • No hardcoded values — use test fixtures or factories
  • CI pipeline runs these tests automatically on every PR

Notes

This is critical before connecting real Stellar payout logic. A broken reward calculation that reaches the blockchain cannot be reversed. Test coverage here protects contributors from incorrect payouts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions