Files
gru_emoney_token-factory/test/api/README.md
defiQUG 651ff4f7eb Initial project setup: Add contracts, API definitions, tests, and documentation
- Add Foundry project configuration (foundry.toml, foundry.lock)
- Add Solidity contracts (TokenFactory138, BridgeVault138, ComplianceRegistry, etc.)
- Add API definitions (OpenAPI, GraphQL, gRPC, AsyncAPI)
- Add comprehensive test suite (unit, integration, fuzz, invariants)
- Add API services (REST, GraphQL, orchestrator, packet service)
- Add documentation (ISO20022 mapping, runbooks, adapter guides)
- Add development tools (RBC tool, Swagger UI, mock server)
- Update OpenZeppelin submodules to v5.0.0
2025-12-12 10:59:41 -08:00

73 lines
1.4 KiB
Markdown

# API Tests
This directory contains integration and contract tests for the eMoney Token Factory API.
## Test Structure
```
test/api/
├── integration/ # Integration tests
│ ├── rest-api.test.ts
│ └── graphql.test.ts
└── contract/ # Contract validation tests
├── openapi-validation.test.ts
└── event-schema-validation.test.ts
```
## Running Tests
```bash
# Run all tests
pnpm test
# Run only integration tests
pnpm run test:integration
# Run only contract tests
pnpm run test:contract
# Watch mode
pnpm run test:watch
```
## Test Types
### Integration Tests
Test actual API endpoints against running services:
- REST API operations
- GraphQL queries and mutations
- End-to-end flows
### Contract Tests
Validate that implementations conform to specifications:
- OpenAPI schema validation
- AsyncAPI event schema validation
- Request/response format validation
## Mock Servers
Use mock servers for testing without requiring full infrastructure:
```bash
# Start all mock servers
cd api/tools/mock-server
pnpm run start:all
# Or start individually
pnpm run start:rest # REST API mock (port 4010)
pnpm run start:graphql # GraphQL mock (port 4020)
```
## Test Environment
Set environment variables:
```bash
export API_URL=http://localhost:3000
export GRAPHQL_URL=http://localhost:4000/graphql
export ACCESS_TOKEN=your-test-token
```