Scorex comes with a dedicated module scorex-testkit for supporting tests at different levels. Testkit contains property tests common for all blockchains and allow to test blockchain node for them.
All test scenarios are combined in BlockchainSanity test, leaving generators to concrete blockchain implementation. This generators are implemented in a test for the Hybrid example.
- Valid block should be successfully applied to history and available by id after that.
- Valid box should be successfully applied to state, it's available by id after that.
- State should be able to generate changes from valid block and apply them.
- Wallet should contain secrets for all it's public propositions.
- State changes application and rollback should lead to the same state and the component changes should also be rolled back.
- Transactions successfully added to memory pool should be available by id.
- Transactions once added to a block should be removed from the local copy of mempool.
- Mempool should be able to store a lot of transactions and filtering of valid and invalid transactions should be fast.
- Minimal state should be able to add and remove boxes based on received transaction's validity.
- Modifier (to change state) application should lead to new minimal state whose elements' intersection with previous ones is not complete (at least some new boxes are introduced and some previous ones removed).
- Application of the same modifier twice should be unsuccessful.
- Application of invalid modifier (inconsistent with the previous ones) should be unsuccessful.
- Application of a valid modifier after rollback should be successful.
- Invalid modifiers should not be able to be added to history.
- Once an invalid modifier is appended to history, then history should not contain it and neither should it be available in history by it's id.
- History should contain valid modifier and report if a modifier if semantically valid after successfully appending it to history.
- BlockchainSanity test that combines all this test.
- Block application and rollback leads to the same history (rollback is not defined for history yet)
- NodeView apply block to both state and history or don't apply to any of them
- It's not possible to apply transaction to a state twice
- Tests for invalid transactions/blocks/etc.