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 creation6CoinFlow.js
โ simulate coin issuance and transfer7AssetLifecycle.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