Open manishbista28 opened 2 years ago
For NEAR implementation, we have implemented a small framework for unit testing, We can try to extend that to other parts of the relay as well. I would highly appreciate your feedback and improvements to the framework.
We have decoupled test data and test cases and created an interface for RPC API that helps us inject mock data for testing.
Test cases are implemented in sender_test.go, receiver_test.go, client_test.go
Test Data is present in https://github.com/icon-project/icon-bridge/tree/hugobyte/development/cmd/iconbridge/chain/near/tests
Mock API mock_api.go facilitates injecting mock data. Default mock data to be injected are defined in default.go and are loaded using a factory factory.go
Default Mock data can be overridden and more data can be loaded from the test data suite as shown in https://github.com/icon-project/icon-bridge/blob/hugobyte/development/cmd/iconbridge/chain/near/tests/get_receipt_proof.go#L23-L32
Overview
Current bmr source code does not include extensive set of unit tests. The ones that are already present make rpc calls to external systems to fetch data. We should be adding more tests to increase code coverage.
Story
Some of the tests can be
Acceptance Criteria
Some of the requirements of a unit test can be