Open veigajoao opened 2 years ago
I'll move this to the high-level docs repo to cover this.
Short answer is you can retrieve all logs through https://docs.rs/near-sdk/latest/near_sdk/test_utils/fn.get_logs.html for unit tests, and workspaces
has it's own way of checking logs for each transaction for e2e tests
Just tested the feature and it's working great, thanks for the information!
On building unit tests for complex smart contracts it is very important to test correct logging of events. Events are the bridge of data between the smart contract's state history and user facing frontend applications. Usually a complex service involves a indexing service that picks up events and logs them to a DB instance, for further processing.
Therefore, it seems very relevant to test the emission of events on unit tests, asserting that they work as expected. Unfortunately, I could find no mention to such testing in the documentation for the SDK.
Am I missing something? Is there a way to perform assertions on emitted events in the current version?
If not, I believe this would be a very beneficial feature add.