Testing - ljcom/operadb GitHub Wiki

๐Ÿงช Testing & Simulations โ€“ OperaDB

This section covers how to test your OperaDB installation and simulate real-world actions using built-in test scripts or custom event injection.


๐Ÿš€ Running Test Scripts

Navigate to the /tests folder and execute scripts using Node.js:

node tests/5CreateActor.js

Example test scripts include:

  • 5CreateActor.js โ€“ test actor creation
  • 6CoinFlow.js โ€“ simulate coin issuance and transfer
  • 7AssetLifecycle.js โ€“ test asset creation and mutation

๐Ÿงฐ Writing Your Own Tests

You can create tests by sending raw event JSON to the API:

curl -X POST http://localhost:3000/api/event.submit      
  -H "Content-Type: application/json"      
  -d '{"type": "asset.create", "actor": "user:test", "data": { "assetId": "asset:x1", "qty": 100 }}'

๐Ÿ“‹ Debugging Tips

  • Use console.log inside reducers for live debugging
  • Use --inspect with Node to enable debugger
  • Check /logs folder for runtime logs and errors

Next: Security & Access